Related Articles
GATE | Quiz for Sudo GATE 2021 | Question 7
• Last Updated : 14 Dec, 2020

Consider following processes with their arrival time and burst time:

Process IDArrival TimeBust Time
P157
P229
P305
P403
P518
P61525

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

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 IDArrival TimeBust TimeTurn Arround TimeWaiting Time
P157103
P2293021
P30583
P40330
P5182214
P615254217

Hence,

```Average waiting time
= (3 + 21 + 3 + 14 + 17) / 6 = 9.66 ns ```

So, all options are correct.

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up