Overview

In this reading we will look at how exceptional behaviors are handled in a computer system. While there are many examples of exceptional behavior, we can classify them according to their cause, return behavior, and their synchronicity, allowing us to reduce the number of possible outcomes from an exception.

This reading will also introduce us to the concept of a process, an abstraction used to describe a program running on a computer system. It may seem odd to pair exceptions with processes, but processes couldn’t exist without exception handling mechanisms, thus their grouping.

Required Reading

Sections 8.0 - 8.2 (pp. 722-737) from the course textbook.

Learning Objectives

BASIC Learning Objectives

Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.

  1. Describe the basic mechanism by which exceptions are handled.
  2. Identify examples of exceptional control flow, classifying them based on their cause, synchronicity, and return behavior.
  3. Compare and contrast how system calls (e.g. fork()) and calling a regular function (e.g. printf) are implemented in x86-64.
  4. Describe the two key abstractions provided by processes to programs.
  5. Compare and contrast concurrency and parallelism.
  6. Describe when and how processes switch from user mode to kernel mode.
  7. Describe at least two possible causes of a context switch and the general mechanism used to perform the switch.

ADVANCED Learning Objectives

The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.

  1. Given data about start and end times of multiple processes, identify which processes are executed concurrently and which are executed in parallel.
  2. Describe how exception handling mechanisms allow us to implement processes and the abstractions they provide.

Pre-class Exercises

These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.

  1. Classify the following exceptions as an interrupt, trap, fault, or abort, or none (i.e. not an exception).

  2. How does the x86-64 syscall instruction differ from the call instruction?

  3. If two programs that are running at the same time on your computer both write to address 0xFACEB007, will they interfere with each other? Explain why or why not.

  4. Assume that you and your partner are working on an assignment that has two parts. If both of you were working at the same time, one doing the first part and one doing the second part, is this an example of concurrency, parallelism, or both? Explain.

  5. Part A: What things are considered part of a process’ context?

    Part B: What happens to the things you identified in Part A when a context switch occurs?