-
Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below:
If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.
-
- 1
- 3
- 5
- 11
Correct Option: B
So, turn around time is for P1 ,P2 ,P3 ,P4 are :
P1 ⇒ (12 - 0) , P2 ⇒ (6 - 3), P3 ⇒ (17 - 5) , P4 ⇒ (8 - 6),
⇒ P1 = 12 , P2 = 3 , P3 = 12 , P4 = 2
As we know that Waiting time = Turn around time - Burst time
So, waiting time for P1 ,P2 ,P3 ,P4 are :
P1 ⇒ (12 - 7) = 5
P2 ⇒ (3 - 3) = 0
P3 ⇒ (12 - 5) = 7
P4 ⇒ (2 - 2) = 0
Hence, avg. waiting time = | = | = 3.0 | ||
4 | 4 |