GATE | Quiz for Sudo GATE 2021 | Question 7
Consider following processes with their arrival time and burst time:
Process ID | Arrival Time | Bust Time |
---|---|---|
P1 | 5 | 7 |
P2 | 2 | 9 |
P3 | 0 | 5 |
P4 | 0 | 3 |
P5 | 1 | 8 |
P6 | 15 | 25 |
Which of the following option(s) is/are correct using preemptive shortest job first scheduling algorithm and all the time in nanoseconds.
Note – This question is multiple select questions (MSQ).
(A) Average waiting time is 9.66 ns
(B) Completion time of process P2 is 32
(C) Turn Round Time of process P5 is 22
(D) Total Turn Round Time is 115
Answer: (A) (B) (C) (D)
Explanation: Using preemptive shortest job first scheduling algorithm, Gantt chart will be
Since, Turn Round Time = Completion time – arrival time, so
P1 = 15 - 5 = 10 P2 = 32 - 2 = 30 P3 = 8 - 0 = 8 P4 = 3 - 0 = 3 P5 = 23 - 1 = 22 P6 = 57 - 15 = 42
Total Turn Round Time is 115.
And, Waiting time = Turn around time – burst time, so
P1 = 10 - 7 = 3 P2 = 30 - 9 = 21 P3 = 8 - 5 = 3 P4 = 3 -3 = 0 P5 = 22 - 8 = 14 P6 = 42 - 25 = 17
Process ID | Arrival Time | Bust Time | Turn Around Time | Waiting Time |
---|---|---|---|---|
P1 | 5 | 7 | 10 | 3 |
P2 | 2 | 9 | 30 | 21 |
P3 | 0 | 5 | 8 | 3 |
P4 | 0 | 3 | 3 | 0 |
P5 | 1 | 8 | 22 | 14 |
P6 | 15 | 25 | 42 | 17 |
Hence,
Average waiting time = (3 + 21 + 3 + 14 + 17) / 6 = 9.66 ns
So, all options are correct.
Quiz of this Question