Last Updated :
26 Oct, 2018
Calculate the average waiting time for the following processes:
Process ID |
Arrival Time |
Bust Time |
P1 |
5 |
7 |
P2 |
2 |
9 |
P3 |
0 |
5 |
P4 |
0 |
3 |
P5 |
1 |
8 |
P6 |
15 |
25 |
Consider the preemptive shortest job first scheduling algorithm and all the time in nanoseconds.
(A) 7.10 ns
(B) 10 ns
(C) 11.6 ns
(D) None of these.
Answer: (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
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 Arround 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, option (D) is correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...