recategorized by
3,069 views
1 votes
1 votes

​​​​​​​Consider the following set of processes and the length of CPU burst time given in milliseconds :

$\begin{array}{|c|c|}  \hline \text{Process} & \text{CPU Burst time (ms)} \\ \hline P_1 & 5 \\ \hline P_2 & 7 \\ \hline P_3 & 6 \\ \hline P_4 & 4 \\ \hline \end{array}$

Assume that processes being scheduled with Round-Robin Scheduling Algorithm with time quantum $4$ ms. Then the waiting time for $P_4$ is ______ ms

  1. $0$
  2. $4$
  3. $12$
  4. $6$
recategorized by

2 Answers

0 votes
0 votes

Time quantum is $4$, assuming every process arrived at $t=0$

When every process uses $1$ time quantum,

0                               4                                8                               12                              16

P1 P2 P3 P4

$P_4$ finished at $t=16$

$waiting\,time= 16-4=12\,ms$

So, $(C)$ should be the answer

0 votes
0 votes
Assume all the processes are arriving at $0$ ms.

$ \begin{array} {|c|c|c|c|c|c|} \hline \textbf{Process} & \textbf{Arrival Time} & \textbf{Burst Time} & \textbf{Completion Time} & \textbf{Turn Around Time} & \textbf{Watting time} \\\hline P_{1} & 0 & 5 & 17 &  17 & 12 \\\hline \ P_{2} & 0 & 7 & 20 & 20 & 13 \\\hline   \ P_{3}  & 0 & 6 & 22 & 22 & 16 \\\hline \ P_{4} & 0 & 4 & 16 & 16 & 12  \\\hline \end {array}$

Gannt chart is as follows:

$\begin{array} {|c|c|c|c|c|} \hline   P_1 & P_2 & P_3 & P_4 & P_1 & P_2 & P_3 \\  {0-4} & 4-8 & 8-12 & 12-16 & 16-17 & 17-20 & 20-22 \\\hline \end{array}$

 

So the waiting time of process $P_4$ is $12$ ms.

Related questions

0 votes
0 votes
1 answer
3