edited by
22,236 views
89 votes
89 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}$
edited by

5 Answers

0 votes
0 votes

As given in question total 'n' processes are there and all those 'n' processes sharing the CPU in Round Robin fashion.

Each process switch takes 's' seconds.

'n' processes -> p1, p2, p3, ..., pn

Quantum size is 'q' -> Which we need to find in a way that overhead resulting from process switching is minimized.

Overhead is Process Switching or Context Switching. Its called overhead as during switching CPU is not executing any process and is not doing any work which can help us improve efficiency.

Each process runs for 'q' time in CPU.

'n' process -> p1 | p2 | p3 | ... | pn | p1

As given that each process is guaranteed to get its turn at the CPU at least every 't' second.

After 't' seconds p1 will be given to CPU for execution. So, sum up all the time and it must be less than or equal to 't' because as we need to give process to CPU again after 't' seconds. if it's more than 't' then you cant guarantee to give process to CPU after 't'.

p1 to p1 it's having 'n' context or process switches.

from p2 to pn total 'n-1' processes and all executing for 'q' Quantum time. We need to count after pi executes so, 'n-1' processes.

(n-1)*q + n*s <= t

Answer:

Related questions

23 votes
23 votes
5 answers
1
2 votes
2 votes
1 answer
4