# GATE Papers >> CSE >> 2019 >> Question No 51

Question No. 51

Consider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below:

 Process P1 P2 P3 P4 Arrival time 0 1 3 4 CPU burst time 3 1 3 Z

These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is 1 millisecond, then the value of Z is________.

##### Answer : 2 to 2

Solution of Question No 51 of GATE 2019 CSE Paper

SRTF

Now, we have P3 and P4 process in ready queue based on 'z' value one she process being scheduled

$\mathrm{Case}\;\boxed1\;\mathrm z>3\;\mathrm{if}\;\left(\mathrm z=4\right)$

We have so schedule process 'P4' Now

wt = TAT - BT

TAT=completion -A

$\begin{array}{l}\mathrm{average}\;\mathrm{wt}=\frac{1+0+1+3}4\Rightarrow\frac54\neq1\;(\mathrm{not}\;\mathrm{matching})\\\mathrm{Case}\;\boxed2\;\mathrm z<3\;\mathrm{if}\;\left(\mathrm z=2\right)\end{array}$

Now, schedule P4

$\mathrm{average}\;\mathrm{wt}=\frac{1+0+3+0}4\Rightarrow\frac44=\boxed1$