2,113 views
2 votes
2 votes
Consider 4 processes sharing the CPU in round robin fashion. If context switch time is 1 sec , what must be the time quantum q such that the number of context switches are reduced , but at the same time each process is guaranteed to get the turn at the CPU for every 10 secs?

-------------------------------------------------------------------------

Ans 2 or 1.5 .

Is here any formula used like (n-1)q+ns

explain in detail

1 Answer

Best answer
2 votes
2 votes
$4$ processes given , Round Robin scheduling always use Circular queue data strucure.

So ordering will be  $P_1\rightarrow P_2 \rightarrow P_3 \ \rightarrow P_4\rightarrow P_1...$ till they exhaust their Burst time.

Now in question its mentioned that in b/w two scheduling on CPU , time should be $10\ sec.$

So considering that scenario would be $Q_1\ |CS \ |Q_2\ |CS \ |Q_3\ |CS\ |Q_4\ |CS\ |Q_1..$

$E_{qn}=3 \times Q \ + 4 \times CS=10$ sec

Given = $CS  \ = \ 1$sec

$\therefore Q=\color{RED}{2sec}$
selected by

Related questions

1 votes
1 votes
1 answer
1
sanyam53 asked Jan 7, 2017
1,653 views
How many time context switch in Round Robin? ( if only one process remain in ready queue at end of scheduling does that count every time, when time slice over or only one...