OS Schedulling
OS Schedulling
Comparison
of
Scheduling
Policies
(Assumes no process
blocks itself, for I/O or
other event wait.)
Multilevel queue scheduling
u Use several ready queues, and associate a different priority with
each queue
u Choose the process from the occupied queue that has the highest
priority, and run that process either:
F preemptively, or
F non-preemptively
u Assign new processes permanently to a particular queue
F Foreground, background
F System, interactive, editing, computing
u Each queue can have a different scheduling policy
F Example: preemptive, using timer
• 80% of CPU time to foreground, using RR
• 20% of CPU time to background, using FCFS
n Problem: processes at low level queues may starve
Multilevel feedback queue
u Use several ready queues, and associate a different priority with
each queue
u Choose the process from the occupied queue with the highest
priority, and run that process either:
F preemptively, or
F non-preemptively
u Each queue can have a different scheduling policy
u Allow scheduler to move processes between queues
F Start each process in a high-priority queue; as it finishes each
CPU burst, move it to a lower-priority queue
F Aging —move older processes to higher-priority queues
F Feedback = use the past to predict the future — favor jobs that
haven’t used the CPU much in the past close to SRT!
Unix CPU Scheduling
u Multiple queues (32), each with a priority value - 0-127 (low value
= high priority):
F Kernel processes (or user processes in kernel mode) the lower
values (0-49) - kernel processes are not preemptible!
F User processes have higher value (50-127)
u Choose the process from the occupied queue with the highest
priority, and run that process preemptively, using a timer (time
slice typically around 100ms)
F Round-robin scheduling in each queue
u Move processes between queues
F Keep track of clock ticks (60/second)
F Once per second, add clock ticks to priority value
F Also change priority based on whether or not process has
used more than it’s “fair share” of CPU time (compared to
others)
u users can decrease priority