By- Nitish Kumar Sandhawar
PRIORITY AND ROUND ROBIN
– CPU scheduling is a process which allows one
process to use the CPU while the execution of
another process is on hold (in waiting state) due to
due to unavailability of any resources like I/O etc,
CPU SCHEDULING CRITERIA
Throughput- Keep the CPU as busy as possible (from 0% to 100%).
CPU utilization-No. of processes that complete their execution per time unit.
Turn AroundTime-Amount of time to execute a particular
Response time-Amount of time it takes from when a request was
submitted until the first
response is produced.
Waiting time-Amount of time a process has been waiting in the
Different Types of Scheduling Algorithm
There are two types of scheduling algorithm :-
a) Preempted SJF (In some Cases)-also called pre-emptive SJF
b) Preempted Priority (In some Cases)-also called pre-emptive
c) Round Robin
d) Multilevel Queue Scheduling
e) Multilevel Feedback Queue
a) First Come First Serve
b) Non-Preempted SJF
The Priority scheduling algorithm is a general case of the SJF
algorithm. It is a non-Preemptive, pre-emptive algorithm and
one of the most common scheduling algorithms in batch
Each process is assigned a priority. Process with highest priority
is to be executed first and so on. Process with same priority are
executed on FCFS basis.
In Priority algorithm priority (p) is the inverse of the given
priority value. The larger the numeric value of priority, the lower
the priority, and vice versa.
Priority can be decided based on memory requirements, time
Wait time of each process is as follows −
Average Wait Time: (9+5+12+0) / 4 = 6.5
Wait Time : Service Time - Arrival
P0 9 - 0 = 9
P1 6 - 1 = 5
P2 14 - 2 = 12
P3 0 - 0 = 0
Reasonable support for priority
Suitable for applications with varying
and resource requirement.
Indefinite blocking or starvation.
A priority scheduling can leave some
priority waiting processes indefinitely
Round Robin is the preemptive process
Each process is provided a fix time to execute,
it is called a quantum.
Once a process is executed for a given time
period, it is preempted and other process
executes for a given time period.
Context switching is used to save states of
The Round Robin scheduling is especially
Wait time of each process is as follows –
Wait Time : Service Time -
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P2 (6 - 2) + (14 - 9) + (20 - 17) =
P3 (9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5
• There is fairness since every process gets equal
• The newly created process is added to end of ready
• A round-robin scheduler generally employs time-
sharing, giving each job a time slot or quantum.
• Very important jobs wait in line.
• Largest job take enough time for completion.
• Setting the quantum too short causes too many context
switches and lower the CPU efficiency.
• Setting the quantum too long may cause poor response