Log In
0 votes

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.Each process must wait no longer than (n − 1) × q time units until its next time quantum.  (Please explain this line too)

For example, with five processes and a time quantum of 20 milliseconds, each process will get up to 20 milliseconds every 100 milliseconds.


Can someone please explain this in a simple way, I'm not getting how each process will get 20 milliseconds every 100 ms?

in Operating System 525 views

2 Answers

3 votes
Best answer

Brother, they are talking about round robbin algorithm, where time quantum ='q' sec.

if you have n processes in ready queue with each have large burst time, the ready queue look like as : P1,P2,...Pn

now, if you run much time it will run? it should be 'q' sec, but it is not completed

therefore add P1 in ready queue, now ready queue look like as : P2,...Pn, P1


now analyze, next time P1 should run when after running of P2,P3,...Pn ====> Each process must wait no longer than (n − 1) × q time units its next time quantum. 


what is the meaning of each process gets 1/n of the CPU time in chunks of at most q time units. ?

therefore in the time of n * q sec, each process can get only $\frac{1}{n}$ * q sec only.


for you example, 5 processes... P1,P2,P3,P4,P5 with tq=20 msec and assume every process requires more than 20 msec

Ready Queue:- P1,P2,P3,P4,P5

0->20 ( after 20 sec P1 looses its turn )  


Ready Queue:- P2,P3,P4,P5,P1

P1 P2
0->20 20->40


Ready Queue:- P3,P4,P5,P1,P2

P1 P2 P3
0->20 20->40 40->60


Ready Queue:- P4,P5,P1,P2,P3

P1 P2 P3 P4
0->20 20->40 40->60 60->80


Ready Queue:- P5,P1,P2,P3,P4

P1 P2 P3 P4 P5
0->20 20->40 40->60 60->80 80->100


Ready Queue:- P1,P2,P3,P4,P5 ==> ready queue is now look like as initial ==> P1 got its turn again after 80 msec => (n-1)*q

P1 P2 P3 P4 P5
0->20 20->40 40->60 60->80 80->100


total of 100 msec, each process get only 20 msec ==> therefore in the time of n * q sec, each process can get only $\frac{1}{n}$ * q sec only.

selected by

@ Shaik Masthan  Thank you so much brother for explaining it very simple and for all the effort and time you put in, Thanks!

0 votes
Look every process will get q quantum of time for excn on its turn. So as in exmple u took there time qauntum is 20ms.

So every process gets 20 ms to execute on its turn all so after first process complete excn 2nd process will excte similarly for this  5th process will complete its  excn at 100 after 100ms your 1st process gets chance to execute again so in this way a process needs to wait (n-1)*q to get its turn back to execute n=5 ,q=20 so one prcoess would wait for 80 ms max not more than this.(if process burst time is more than time quantum)

And it can be said in this way too each process will get 20 ms in 100 ms after 100ms process 1 will again get chance to execute.

@ Shubham Shukla 6  Got it brother! Thanks for explaining ir nicely.

Related questions

0 votes
1 answer
Let's say we have four processes as (P1, P2, P3, P4) and have Arrival time as (0,1,2,3) respectively, but all of them has same CPU Burst time as (10ms) then does SRTF will simply be behaving like FCFS?
asked Jul 17, 2018 in Operating System iarnav 250 views
0 votes
0 answers
Consider a situation where there are 4 processes executing using RR scheduling. The processes are arriving at different intervals of time. Now, suppose P3 arrives when P2 is executing(before completing its quantum) then what should be scheduled next P1 or P3? P1 -------------- ... SRTF scheduling, where Burst time of P3 is < Burst time of P1, then what should be scheduled next(after P2) P1 or P3?
asked Nov 28, 2017 in Operating System Tuhin Dutta 76 views
2 votes
0 answers
Consider a system having $10$ IO bound jobs and $1$ CPU bound job.. If IO bound job issue an IO request once for every ms of CPU computation and that each IO request takes $10$ ms. If context switch overhead is $0.1$ ms.Using round -robin scheduling with a time quantum of $10$ ms. , the CPU efficiency is __________________
asked Mar 11, 2019 in Operating System srestha 242 views
0 votes
1 answer
In which of the following case CPU utilization will be higher? (a) If all the processes are I/O bound (b) Is all the processes are equally CPU bound and I/O bound (c) If all the processes are CPU bound (d) Both (B) and (C)
asked Feb 14, 2019 in Operating System Ram Ahuja 296 views