# ISRO | ISRO CS 2009 | Question 17

• Last Updated : 15 Oct, 2020

Consider a set of 5 processes whose arrival time, CPU time needed and the priority are given below:

```Process       Arrival Time   CPU Time Needed     Priority
(in ms)

P1              0             10                 5
P2              0             5                  2
P3              2             3                  1
P4              5             20                 4
P5              10            2                  3```

(smaller the number, higher the priority)
If the CPU scheduling policy is priority scheduling without preemption, the average waiting time will be

(A) 12.8 ms

(B) 11.8 ms
(C) 10.8 ms
(D) 9.8 ms

Explanation: Following is the Gantt diagram:

Waiting time = turn around time – burst time
Turn around time = completion time – arrival time

```
Arrival Time  CPU Time   Priority  turnaround time    Waiting Time
(in ms)     Needed

P1      0             10          5           40 - 0 = 40    40 - 10  = 30
P2      0             5           2           5 - 0 = 5       5 - 5  = 0
P3      2             3           1           8 - 2 = 6       6 - 3  = 3
P4      5             20          4           28 - 5 = 23     23 -20 = 3
P5      10            2           3           30 - 10 = 20    20 - 2 = 18```

Average Waiting Time = (30 + 3 + 3 + 18)/ 5 = 10.8

So, option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up