Open In App

GATE | GATE CS 2019 | Question 50

Like Article
Like
Save Article
Save
Share
Report issue
Report

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


Answer: (A)

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 

So, answer is 2.

Watch GeeksforGeeks Video explanation :



Quiz of this Question


Last Updated : 22 Jul, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads