This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ority Scheduling
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority
(smallest integer ≡ highest priority).
SJF is a priority scheduling where priority is the predicted
next CPU burst time.
Problem with priorities? Round
Round Robin (RR)
Each process gets a small unit of CPU time (time quantum), e.g. 10100
100 milliseconds. After this time has elapsed, the process is
preempted and added to the end of the ready queue.
If there are n processes in the ready queue and the time quantum is
q, then each process gets 1/n of the CPU time in chunks of at
most q time units at once. No process waits more than (n-1)q
• q large ~ scheduling algorithm?
• q small problems? Example:
Example: RR with Time Quantum = 20
The Gantt chart is: P1
20 37 P3 Burst Time
97 117 P4 P1 P3 P3 121 134 154 162 Compare to SJF: avg turnaround time and response
Typically, higher average turnaround than SJF, but better response. How
How a Smaller Time Quantum Increases Context Switches Turnaround
Turnaround Time Varies With The Time Quantum ^ quanta:
Policy versus Mechanism
Separate what from how
• priority scheduling mechanism, how to set priorities => policy
• RR mechanism, how to set quanta => policy
Other Examples? 15 Multilevel Queue
Multilevel Queue Scheduling
Ready queue is partitioned into separate queues, e.g.:
foreground (interactive) – I/O bound
background (batch) – CPU-bound
Each queue has its own scheduling algorithm, e.g.
foreground – RR – why?
background – FCFS
Scheduling must be done between the queues.
• Fixed priority scheduling; i.e., serve all from foreground then from
• Time slice – each queue gets a certain amount of CPU time which it can
schedule amongst its processes; e.g.,
80% to foreground jobs in RR
20% to background jobs in FCFS Multilevel
Multilevel Queue Scheduling Multilevel
Multilevel Feedback Queue
A process can move between the various queues; aging can
be implemented this way. Feedback -> move bet. queu...
View Full Document
This document was uploaded on 04/02/2014.
- Summer '14
- Operating Systems