Lecture 22 Process Scheduling for Batch Systems Review
Lecture 22: Process Scheduling for Batch Systems
Review: Categories of Process Scheduling • Batch Systems (Compute Servers) – Many processes, not interactive, throughput is important • Interactive Systems – PC • Real Time Systems – Guaranteed response times, meet deadlines
Review: Scheduling Algorithm Goals • All Systems – Fairness – giving each process a fair share of the CPU – Policy enforcement – seeing that stated policy is carried out – Balance – keeping all parts of the system busy
Review: Scheduling Algorithm Goals • Batch Systems – Throughput – maximize jobs per hour – Turnaround time – minimize time between submission and termination – CPU utilization – keep the CPU busy all the time
Review: Scheduling Algorithm Goals • Interactive Systems – Response time – respond to requests quickly – Proportionality – meet users’ expectations
Review: Scheduling Algorithm Goals • Real-time Systems – Meeting deadlines – avoid losing data – Predictability – avoid quality degradation in multimedia systems
Scheduling Algorithms for Batch Systems • First come first serve • Shortest job first • Shortest remaining time next
First Come First Serve (FCFS) • Maintain queue of processes • Schedule first in queue • Scheduled job executes until it finishes or blocks for I/O • Simple, easy to implement • Not good for mix of short and long jobs – Example: a short job arriving soon after a long one
FCFS Arrival time CPU burst 0 P 1: 4 36 8 112 1 13 P 2: 23 40 2 16 P 3: 4 20 112 40 1 20 P 4: 2 150 3 10 1 0 I/O burst
FCFS 0 P 1: 4 36 8 112 1 13 P 2: 23 40 2 16 P 3: 4 20 112 40 1 20 P 4: 2 150 3 10 1 Which process goes next? P 1 idle P 2 P 3 P 4 0 4 13 36 40 42
FCFS Time next ready 40 0 P 1: 4 36 8 112 1 76 13 P 2: 23 40 2 60 16 P 3: 4 20 112 40 1 192 20 P 4: 2 150 3 10 1 Which process goes next? P 1 idle P 2 P 3 P 4 0 4 13 36 40 42
FCFS Time next ready 40 0 P 1: 4 36 8 112 1 76 13 P 2: 23 40 2 60 16 P 3: 4 20 112 40 1 192 20 P 4: 2 150 3 10 1 P 1 idle P 2 P 3 P 4 P 1 idle P 3 0 4 13 36 40 42 50 60 172
FCFS 162 0 P 1: 4 36 8 112 1 76 13 P 2: 23 40 2 212 16 P 3: 4 20 112 40 1 192 20 P 4: 2 150 3 10 1 P 1 idle P 2 P 3 P 4 P 1 idle P 3 0 4 13 36 40 42 50 P 2 60 172 P 1 174 idle 175 192 P 4
Shortest Job First • Suppose 3 jobs arrive • Shortest Job First: 8 1 2 1 3 11 Sum of turnaround times = 15 • Scheduler X: 8 10 11 Sum of turnaround times = 29
Shortest Remaining Time Next • Next schedule the job with the shortest time to completion • Fairness problems: A long job might be continually preempted by many short jobs
Realistically. . . • Jobs don’t run to completion – run till they block for user input • Don’t know the length of “jobs” • How long is that? – predict using past behavior
- Slides: 16