Lecture 5: Processes

Reading: OSTEP, up to Ch. 6

Warm-up Question

Introduction

“An OS is a land of magic and illusions”

Processes

Limited Execution and Time Sharing

Time Process 1 Process 2 Process 3
0 starts starts starts
1 Running Ready Ready
2 Running Ready Ready
3 Running Ready Ready
4 Running Ready Ready
5 Ready Running Ready
6 Ready Running Ready
7 Ready Running Ready
8 Ready Running Ready
9 Ready Ready Running
10 Ready Ready Running
11 Ready Ready Running
12 Ready Ready Running
13 Running Ready Ready
14 Running Ready Ready
15 Running Ready Ready
16 done Running Ready
17 Running Ready
18 Running Ready
19 Running Ready
20 Ready Running
21 Ready Running
22 Running done
23 Running
24 Running
25 done

scheduling

The act of letting the process take control of the CPU

descheduling

Removing the process from the CPU to use it for something else


           deschedule
+---------+ -------> +-------+
| Running |          | Ready |
+---------+ <------- +-------+
        \   schedule   ^ 
   I/O   \            /  I/O
requested \          /  completed
           v        /   
          +---------+    
          | Blocked |    
          +---------+

Switching Between Processes

Cooperative Multitasking

Preemption

Mechanism: Exceptional Control Flow

  1. Asynchronous
  2. Synchronous
    1. Traps
    2. Faults
    3. Aborts

To be continued…

In the meantime, see the slides for a discussion of exceptional control flow.