You are on page 1of 3

Round Robin Algorithm

Round-robin (RR) is one of the pre-emptive algorithms employed by process and network schedulers in
computing. As the term is generally used, time slices are assigned to each process in equal portions and
in circular order, handling all processes without priority. Round-robin scheduling is simple, easy to
implement and starvation-free.

Time Quantum: A Time Quantum (TQ) is the amount of time share give to each process, interrupting the
job if it is not completed by then.

Request Queue: A request queue is the order by which processes arrive and are handled

If the CPU scheduling is Round Robin with time quantum is equal to 3 units,

Process Name ID Arrival Time Burst Time


P1 0 5
P2 1 3
P3 3 6
P4 5 1
P5 6 4

Given:
Time Quantum = 3 Request Queue
P1
P2
First the process P1 arrived P3
P1 burst time subtract to Time quantum P1
5–3=2 P4
The remaining time of P1 is 2secs P5
P3
Then with 2 seconds P2 and P3 arrives
P5
We put them in the request queue
But since P1 is not been completed because there is
Remaining 2sec left we have to put P1 again in the queue
And execute it another time

Next in queue is P2 we execute it


P2 burst time subtract to Time quantum
3–3=0
There is no remaining time in P2 so the process is completed
And not going back to the request queue
To be executed another time
So, within 6 sec P4 and P5 arrived in the CPU
Put P4 and P5 in the request queue

Next in queue is P3
P3 burst time subtract to Time quantum
6 – 3 = 3 sec
But since P3 is not been completed because there is
Remaining 2sec left we have to put P3 again in the queue
And execute it another time

Next in queue is P1 we execute it again


P1 burst time subtract to Time quantum to finish it time left
2–3=1
That is 9 to 11
There is no remaining time in P1 so the process is completed
And not going back to the request queue

Next is P4
We execute it for once because it has only one second
There is no remaining time in P4 so the process is completed
So, process P4 is from 11 – 12

Next in the queue is P5


We execute P5
P5 burst time subtract to Time quantum
We execute P5 from 12 to 15
This leaves P5 with remaining time of 1
So, it goes back in queue

Next in queue is P3
We execute it for 3 sec from 15 to 18 sec
Since P3 have remaining time of 3 sec the process is completed

Finally, P5 with the remaining of 1 sec


We execute P5 with 1 sec
From 18 – 19
And process P5 is done

P1 P2 P3 P1 P4 P5 P3 P5
0 3 6 9 11 12 15 18 19

You might also like