OS 6 CPU Scheduling
OS 6 CPU Scheduling
CPU SCHEDULING
Outline
• Basic Concepts
• Scheduling Criteria
• Scheduling Algorithms
Basic Concepts
• Maximum CPU
utilization obtained with
multiprogramming
• CPU–I/O Burst Cycle –
Process execution
consists of a cycle of
CPU execution and I/O
wait
• CPU burst followed by
I/O burst
• CPU burst distribution is
of main concern
Histogram of CPU-burst Times
Large number of short bursts
P1 P2 P3
0 24 27 30
P2 P3 P1
0 3 6 30
P4 P1 P3 P2
0 3 9 16 24
• Commonly, α set to ½
Prediction of the Length of the Next CPU Burst
Examples of Exponential Averaging
• =0
n+1 = n
– Recent history does not count
• =1
n+1 = tn
– Only the actual last CPU burst counts
• If we expand the formula, we get:
n+1 = tn+(1 - ) tn -1 + …+(1 - )j tn -j + … +(1 - )n +1 0
P1 P2 P4 P1 P3
0 1 5 10 17 26
• Three queues:
– Q0 – RR with time quantum 8
milliseconds
– Q1 – RR time quantum 16 milliseconds
– Q2 – FCFS
• Scheduling
– A new process enters queue Q0 which is
served in RR
• When it gains CPU, the process receives
8 milliseconds
• If it does not finish in 8 milliseconds, the
process is moved to queue Q1
– At Q1 job is again served in RR and
receives 16 additional milliseconds
• If it still does not complete, it is
preempted and moved to queue Q2
Reference: Operating System Concepts, Abraham Silberschatz,
Peter Baer Galvin, Greg Gagne, Wiley Publications