8 - RR, Priority CPU Scheduling
8 - RR, Priority CPU Scheduling
8 - RR, Priority CPU Scheduling
Process/CPU Scheduling
Content
Recap: Example of FCFS, SJF, SRTF
Process Scheduling Algorithms
Priority Scheduling
Non-Preemptive
Preemptive
Round-Robin
Multi-level Queue
Multi-level Feedback Queue
Round Robin (RR) Scheduling
Criteria: Time Quantum
Mode: Preemptive
Sequence of processes in the ready queue
Each process gets a small unit of CPU time (time quantum q), usually 10-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 time units.
Timer interrupts every quantum to schedule next process
Performance
◦ q large FIFO (FCFS)
◦ q small RR
RR Scheduling Cont..
Note that q must be large with respect to context switch, otherwise overhead is
too high
Typically, higher average turnaround than SJF, but better response time
Time Quantum and Context Switch Time
Turnaround Time Varies With The Time Quantum
Criteria: Priority
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority (smallest integer
highest priority)
Preemptive
Non-preemptive
SJF is priority scheduling where priority is the inverse of predicted next CPU
burst time
Problem: Starvation (indefinite blocking)– low priority processes may never
execute
Solution: Aging – as time progresses increase the priority of the process/
gradually increasing the priority of processes that wait in the system for a long
time.
Example of Priority Scheduling (non-preemptive)
If two processes have same priority then go with arrival time.
Example of Priority Scheduling (preemptive)
If two processes have same priority then go with arrival time.
Mixed Burst time (CPU & I/O Both)