9/20/2018 Three-Level Scheduling CPU CPU scheduler Scheduling Arriving jobs How to choose which of the Ready Main memory processes/threads gets to Run next Admission Memory Input queue scheduler scheduler CPU Bound vs. I/O Bound Total CPU usage CPU bound Batch Scheduling CPU bursts I/O waits Non-interactive jobs that can be run I/O bound “overnight” Total CPU usage Time When to Schedule • Process Creation • Process Exit • Blocked Throughput • I/O Interrupt Number of jobs completed per unit time • Clock Interrupts 1
9/20/2018 Shortest Job First (SJF) Turnaround Time Current job queue Time from job submission to job 4 3 6 3 completion A B C D SJF scheduler Average Turnaround Time 3 3 4 6 Average of all turnaround times for a set B D A C of jobs Execution order Fairness Interactive scheduling Comparable processes get comparable Impatient users waiting service First Come, First Served Round Robin Scheduling Current job queue A B C D E 4 3 6 3 A B C D Quantum E FCFS scheduler D C 4 3 6 3 B A A B C D Time Execution order 2
9/20/2018 Priority Scheduling High Priority 4 Policy Priority 3 Priority 2 The rules a particular mechanism should Priority 1 follow (i.e., the parameters of an algorithm) Low Ready processes Other Scheduling Algorithms • Shortest Process Next – SJF applied to Interactive Systems • Guaranteed Scheduling Earliest Deadline First (EDF) – N processes get 1/N of the CPU Time • Fair Share Real-time: How you do homework – N users get 1/N CPU time • Lottery Scheduling – Give out tickets, pull one at random, winner runs Scheduling User Threads Process A Process B Mechanism The way something is done (e.g., an algorithm) Kernel Run-time Thread Process system table table 3
9/20/2018 Scheduling Kernel Threads Process A Process B Kernel Process Thread table table 4
Recommend
More recommend