Creators: Chris St. Jacques, Jose Perez, Thomas Markes


Scheduling (OS must manage resources) Cooperative threading: Unsafer + Faster Preemptive Threading: Processes: safer + slower, also multicore suitable

Event Driven Programming

Scheduling n CPUs > n runnable threads
Threads can have other states: zombie, blocked, waiting, timer wait, runnable, etc

What we need:
Policies- choose which threads to run
Mechanisms- low level implementation to make it actually work

Scheduling scale Every scheduler sucks! How to measure how bad your scheduler is: metrics - derived before computing, assembly line

Automobile and emacs example of metrics
Automatics and Emacs (Example of Metrics)

What we expect from our scheduler *Note: these are competing metrics
What you want to know about your scheduler is the average wait time, the variance, and the worst case

Simplest Scheduler: First-Come-First-Served (FCFS)
Job Arrival Time Run Time Wait Time
A 0 3 0
B 1 1 2 + k ( k is context switching time)
C 2 7 2 + 2k
D 3 4 8 + 3k

Average wait time: 3 + 1.5k
Worst case: 8 + 3k
Turnaround is 'Avg runtime' + 'Avg wait time'

Shortest Job First Scheduler
Job Arrival Time Run Time Wait Time
A 0 3 0
B 1 1 2 + k
C 2 7 6 + 3k
D 3 4 1 + 2k

Average wait time: 2.25 + 1.5k

(+) SJF always dominates FCFS in average wait time
(-) SJF is unfair: a job might wait forever