edited by
8,494 views
24 votes
24 votes
Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below:
$$\small \begin{array}{|c|c|c|} \hline \textbf{Process} & \textbf{Arrival Time} & \textbf{Burst Time}\\\hline \text{$P_1$} & 0 & 7 \\\hline \text{$P_2$} & 3 & 3 \\\hline \text{$P_3$} & 5 & 5 \\\hline \text{$P_4$} & 6 & 2 \\\hline  \end{array}$$If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _____________ milliseconds.
edited by

3 Answers

Best answer
40 votes
40 votes
Gantt Chart

$$\small \begin{array}{|c|c|c|c|c|c|} \hline \textbf{Process} & \textbf{Arrival } & \textbf{Burst} & \textbf{Completion} & \textbf{Turn Around } & \textbf{Waiting Time} \\
& \textbf{Time} & \textbf{Time} & \textbf{Time} & \textbf{Time} & \textbf{= CT - BT -AT} \\
\hline
\text{P1} & 0 & 7 & 12 & 12 & 5 \\ \text{P2} & 3 & 3 & 6 & 3 & 0 \\ \text{P3} & 5 & 5 & 17 & 12 & 7 \\ \text{P4} & 6 & 2 & 8 & 2 & 0 \\\hline   \end{array}$$Average Waiting Time $=\frac{(5 + 0 + 7 + 0)}{4} = 3$ milliseconds

edited by
7 votes
7 votes

Calulations $:$ Sum of (Complete time -(Arrival Time +Burst Time ) ) for all processes

                 i.e  $\frac{(17-10) +(12- 7)+(8-8) +(6-6)}{4}=\frac{12}{4}$

                      $=3$ msec

edited by
0 votes
0 votes
ans is 3 ms. waiting time is 3 ms
Answer:

Related questions