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


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: (Hardware) Interrupts
  2. Synchronous
    1. Traps
      • Intentionally triggered by the software - system calls, breakpoints
      • System calls are the primary mechanism of how user programs can interact with the OS
      • Used to request a service from the OS - The service code needs to execute in privileged mode
    2. Faults
      • Unintentionally triggered
      • Potentially recoverable
      • Page faults, floating point exceptions
    3. Aborts
      • Unintentionally triggered
      • Unrecoverable
      • Illegal instruction, RAM parity errors

To be continued…