edited by
37,071 views
140 140 votes

Consider $n$ processes sharing the CPU in a round-robin fashion. Assuming that each process switch takes $s$ seconds, what must be the quantum size $q$ such that the overhead resulting from process switching is minimized but at the same time each process is guaranteed to get its turn at the CPU at least every $t$ seconds?

  1. $q \leq \frac{t-ns}{n-1}$
  2. $q \geq \frac{t-ns}{n-1}$
  3. $q \leq \frac{t-ns}{n+1}$
  4. $q \geq \frac{t-ns}{n+1}$

11 Answers

Best answer
157 157 votes

Answer: (A)

Each process runs for q period and if there are n process: $p_{1}$, $p_{2}$,$p_{3}$,, ....., $p_{n}$,.
Then $p_1$'s turn comes again when it has completed time quanta for remaining process p2 to pn, i.e, it would take at most $(n-1)q$ time. 
So,, each process in round robin gets its turn after $(n-1)q$ time when we don't consider overheads but if we consider overheads then it would be $ns + (n-1)q$
So, we have $ns + (n-1)q \leq t$

edited by
45 45 votes

ANS is A

Let us take a simple example of 4 processes P1 , P2 , P3 and P4 . Here n=4

Consider  P1 || P2 || P3 || P4 || P1 || P2 || ..... will be the round robin scheduling order.

Now acc to the question the context switch time is S , here context is shown by " || "

and time quantum is " Q "

and T is the time taken by a process to again get the CPU after scheduling once .

if we see our scheduling pattern P1 || P2 || P3 || P4 || P1 || P2 ||

P1 gets the CPU again after 4 ( = n) context switch and 3 ( =n-1) time quantum.

So 4S + 3Q <= T

In general, where n is the process count , this becomes

nS + (n-1) Q <= T

(n-1)Q <= T - nS

=> Q <= (T- nS ) / ( n-1)

Answer:
Position:
Show:

Related questions

34 34 votes
5 answers 5 answers
35.3k
35.3k views
Kathleen asked Sep 29, 2014
35,330 views
Consider a system having $m$ resources of the same type. These resources are shared by $3$ processes $A, B$, and $C$ which have peak demands of $3, 4$, and $6$ respective...
55 55 votes
12 answers 12 answers
28.0k
28.0k views
Kathleen asked Sep 14, 2014
27,953 views
Suppose a processor does not have any stack pointer registers, which of the following statements is true?It cannot have subroutine call instructionIt cannot have nested s...
3 3 votes
1 1 answer
7.2k
7.2k views
go_editor asked Jul 6, 2016
7,217 views
Which level of abstraction describes what data are stored in the database? Physical levelView levelAbstraction levelLogical level
12 12 votes
3 answers 3 answers
16.1k
16.1k views
focus _GATE asked Jul 17, 2015
16,138 views
What are the final values of $\text{Q}_1$ and $\text{Q}_0$ after $4$ clock cycles, if initial values are $00$ in the sequential circuit shown below:$11$$01$$10$$00$