Process Scheduling ( ) CPE Operating Systems
The Assumption that Makes Multiprogramming Work CPU-Bound Process I/O-Bound Process Figure 5.1
Process Scheduling Figure 3.6
Scheduling Circumstances (5.1.3) Figure 3.2
Scheduling Modes A B Non-Preemptive AB Preemptive A A B
Scheduling Modes: Nonpreemptive (Cooperative)
Scheduling Modes: Preemptive
Ever seen Windows 1.0?
Scheduling Criteria (5.2) CPU Utilization (Percent) Throughput (Processes per time unit) Turnaround time (time units) Waiting time (time units) Response time (time units)
Scheduling Algorithms (5.3)
First-Come, First-Serve (FCFS) ProcessBurst Time P 1 24 P 2 3 P 3 3 Waiting time for P 1 = 0; P 2 = 24; P 3 = 27 Average waiting time: ( )/3 = 17 P1P1 P2P2 P3P
First-Come, First-Serve (FCFS) P2, P3, P1 P1P1 P3P3 P2P Waiting time for P1 = 6; P2 = 0; P3 = 3 Average waiting time: ( )/3 = 3
Shortest-Job-First Scheduling (SJF) SJF is optimal – gives minimum average waiting time Two schemes: Nonpreemptive Preemptive (shortest-remaining-time-first)
Predicting CPU Burst Time Exponential Average
Prediction Example Figure 5.3 Prediction Actual