edited by
13,381 views
33 33 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.

4 Answers

Best answer
54 54 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
9 9 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
Answer:
Position:
Show:

Related questions

71 71 votes
7 answers 7 answers
28.9k
28.9k views
Arjun asked Feb 14, 2017
28,851 views
Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:$S_1$: Random pa...
192 192 votes
11 answers 11 answers
60.5k
60.5k views
Arjun asked Feb 14, 2017
60,495 views
A multithreaded program $P$ executes with $x$ number of threads and uses $y$ number of locks for ensuring mutual exclusion while operating on shared memory locations. All...
67 67 votes
8 answers 8 answers
26.6k
26.6k views
Arjun asked Feb 14, 2017
26,639 views
Threads of a process shareglobal variables but not heapheap but not global variablesneither global variables nor heapboth heap and global variables
89 89 votes
12 answers 12 answers
28.7k
28.7k views
Arjun asked Feb 14, 2017
28,683 views
A cache memory unit with capacity of $N$ words and block size of $B$ words is to be designed. If it is designed as a direct mapped cache, the length of the $\textsf{TAG}$...