1 scheduling algorithms fcfs first-come, first-served round-robin sjf multilevel feedback queues
Post on 22-Dec-2015
249 views
TRANSCRIPT
2
Round-Robin Scheduling Quantum expires: move to back of
ready queue Variants used in most real systems
Tradeoffs: length of quantum Large: response time increases Small: throughput decreases
quantum →0 = overhead dominates context switches, cache misses
14
Round-Robin vs. FCFS
Example 1: 5 jobs, 100 seconds each, quantum
= 1s ignore context switch time
15
Round-Robin vs. FCFS
Example 1: 5 jobs, 100 seconds each, quantum
= 1s ignore context switch time
18
This Time: Scheduling Algorithms
FCFS First-Come, First-Served
Round-robin SJF Multilevel Feedback Queues
27
SJF/SRTF: Shortest-Job First
Advantages: Provably optimal – minimizes average
waiting time Works for preemptive & non-preemptive
schedulers Preemptive SJF = SRTF
Shortest remaining time first
Disadvantages: Impossible to predict CPU time job has left Long-running CPU-bound jobs can starve
28
This Time: Scheduling Algorithms
FCFS First-Come, First-Served
Round-robin SJF Multilevel Feedback Queues
29
Multilevel Feedback Queues (MLFQ)
Use past behavior to predict future, assign job priorities Overcome prediction problem in SJF
Assumption: I/O-bound in past, I/O-bound in future Scheduler favors jobs that used least
CPU time Adaptive:
Change in behavior → change in scheduling decisions
30
MLFQ: Approximating SJF
Multiple queues, different priorities Round-robin scheduling at each
priority level Run all jobs at highest priority first (till
this queue is empty), then next, etc. Can lead to starvation
Increase quantum exponentially at lower priorities
32
MLFQ: Assigning Priorities
Job starts in highest priority queue Quantum expires → CPU-bound
Drop priority one level Quantum does not expire → I/O-bound
Increase priority one level
CPU-bound jobs move down,I/O-bound jobs move up