# GATE | GATE CS 2019 | Question 50

Consider the following four processes with arrival times (in milliseconds) and their length of CPU burst (in milliseconds) as shown below: 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 __________.

Note: This was Numerical Type question.
(A) 2
(B) 3
(C) 1
(D) 4

Explanation: Using shortest remaining time (SRTF) first CPU scheduling algorithm,

Let Z = 1, then gantt chart will be, Average waiting time,

```= {(4-0-3) + (2-1-1) + (8-3-3) + (5-4-1)} / 4
= (1 + 0 + 2 + 0) / 4
= 3 / 4
= 0.75 ```

Now, let Z = 2, then gantt chart will be, Average waiting time,

```= {(4-0-3) + (2-1-1) + (9-3-3) + (6-4-2)} / 4
= (1 + 0 + 3 + 0) / 4
= 4 / 4
= 1 ```

Quiz of this Question

My Personal Notes arrow_drop_up

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.