278 views

Consider 3 processes P0P1 and P2 to be scheduled as per the SRTF algorithm. The process ‘P0’ is known to be scheduled first and when ‘P0 has been running ‘6’ units of time, then the process ‘P2’ has arrived. The process ‘P2’ has run for ‘4’ unit of time,then the process ‘P1’ has arrived and completed running in ‘5’ units of time. Then the minimum burst time of ‘P0’ is _______ (in units).

Please explain how to solve this. Ans is given 17

Let P0's BT be x units and P2's BT be y units.

Now, when P0 has finished 6 units, means left is x-6. But at this moment P2 has been given next chance. Since it is SRTF, so P2 getting chance/priority more than P0  means P2's BT must have been less than the remaining BT of P0. Otherwise P0 would have continued.

So, y< x-6 ....(i)

Now, P2 executed for 4 units after which P1 came and it was given the CPU time. P1 takes 5 units.

This means P1's BT< the remaining BT of P2. Otherwise P2 would have continued.

The remaining BT of P2 is y-4.

So, 5< y-4.

y> 9  hence min. Value of y is 10.

From equation (i),

y<x-6 => 10<x-6 => x> 16 => min(x)= 17.

@MiNiPanda   nice and precise explanation thanks

Thank you :P
here in the above question arrival time for p1,p2,p3 are 0,10,6 and

here they using SRTF scheduling algorithm

1st p0 is executing for 6 unit and then p2 is scheduling means p2 have less remaining time than p0

2nd p2 is executing for 4 unit and then p1 is arrived and run complete for 5 unit, so we can say that

p2 may have 5(p1 burst time)+4(p2 1st execution time)+1(at least 1 more )=10 unit,

like that for p0 10(p2)+6(p0)+1(unit more)=17 unit.