The Gateway to Computer Science Excellence
+2 votes
90 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 

in Operating System by (357 points) | 90 views

2 Answers

+2 votes
Best answer
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.
by Boss (23.5k points)
selected by
0

@MiNiPanda   nice and precise explanation thanks

+1
Thank you :P
0 votes
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.
by (249 points)
0

p2 may have 5(p1 burst time)+4(p2 1st execution time)+1(at least 1 more )=10 unit,   can you explain this line in detail ?  @meethunjadhav

+1
p2 is arriving after p0 and before p1 hence p0>p2>p1

So,p2 have 4(p2 burst time)+6(p1 is running for 5 unit means it arrive early than p2 means p2 must have more than p1 burst time that's why 6  )=10 unit

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,366 answers
198,496 comments
105,265 users