Anonymous user menu

SRTF algorithm

Consider the following set of processes,with the arrival times and the CPU-burst times for the processes P0,P1 and P2.

P0 0ms 9ms
P1 1ms 4ms
P2 2ms 9ms

The pre-emptive shortest job first scheduling algorithm is used.Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three process?

a. 5.0 ms               b. 4.33ms          c. 6.33 ms            d. 7.33 ms          


waiting time = compilation time - arrival time - burst time

 average waiting time= total waiting time/total no. of process

create gantt chart

P0 P1 P0 P2

0                         2                         5                          13                         22

  waiting time(P0) = 13-0-9 = 4

waiting time(P1) = 5-1-4 = 0

waiting time(P2) = 22-2-9 =11

average waiting time = 15 /3

                                 =5, ans is a.