previous | start | next

Shortest Remaining Time First (SRTF)

Gantt Chart:
        +------------------------------------------+
        |  P1      |  P3     |      P2             |
        +------------------------------------------+
        0          4         8                    14

        Time     0       1       2      
        READY    P1(4)   P1(3)   P1(2)
                         P2(6)   P2(6)
                                 P3(4)
     

From the Gantt chart, finish times are:

Process Finish Wait
P1 4 0
P2 14 7
P3 8 2

So, for example, the wait time for P3 is:

        Wait = Finish - Arrival - CPU_Burst = 8 - 2 - 4 = 2
     

and the average wait time for these three:

        Avg. Wait = (0 + 7 + 2)//3 = 3.000 
     


previous | start | next