in Operating System
2,229 views
5 votes
5 votes
Consider a System with n–processes arriving at time 0. Scheduling overhead is ‘s’ seconds. Using Round Robin CPU Scheduling what must be the value of time quantum ‘q’ such that each process is guaranteed to gets its turn on the CPU in its subsequent run exactly twice within ‘t’ sec (inclusive)?

please give detailed explaination.
in Operating System
2.2k views

1 Answer

5 votes
5 votes
Best answer

See first we verify this for smaller no of processes ..Say we have 2 number of processes..So according to the question :

|| P1 || P2 || P1 || P2 ||

So since the word  " inclusive " is used we have to consider all the time intervals involved here including first and last overheads(context switches)..

So here we can see we have 4 time quanta and 5 context switches..Hence for n processes , we can generalise it as :

Having 2n time quanta and (2n + 1) context switches..Hence ,

            2n q + (2n + 1) s  =  t

==>      2n q     =  t - (2n + 1)s

==>      q         =  [t - (2n + 1)s] / 2n

Hence the required time quantum is q =   [t - (2n + 1)s] / 2n 

selected by

4 Comments

I think in exclusive scenario the first and last context switches will not be considered..
And if it is at least  twice , then inequality will come into picture which will be manifested as time quantum will decrease as  the number of quanta dedicated to  a process will increase ..
So the question will then ask for maximum time quantum possible..

Similarly for at most twice , it will ask for minimum time quantum possible considering the given constraints..
1
1
@Habib. The last 's' can be ignored since all the processed have got 2 quantums in 't' period.

SO, it would be  $\frac{t-2ns}{2n}$
1
1
@Habib. Sorry, calculated for only 1 't' unit.   Your answer is correct.
0
0

Related questions