in Operating System
2,036 views
0 votes
0 votes
Consider 3 processes P0 ,P1, P2 to be scheduled as per the SRTF algorithm. the process P0 is known to be scheduled first ad and when P0 is running 5 units of time, the process P2 has arrived. When the process P2 has run 2 units of time , the process P1 has arrived and completed running in 4 units of time. Then minimum burst time of P0 is............(in units).

Given answer is 12 ..

I think it should be 10 pls verify what should be correct answer..
in Operating System
2.0k views

11 Comments

it should be 13, due to SRTF will preempt the process when there is availability of strictly shorter BT process.

i mean, if you are running Pa , after some time, let at time k, remaining required Burst time of Pa = A, if a new Process Pb arrive with Burst time B.

Pb will select for running by SRTF if B < A, but not B ≤ A .

 

P0 = 5+(Burst time of P2)+1 --> after 5 units, P0 is preempted,then it must be atleast 1 unit more than B.T. of P2.

P2 = 2+(Burst time of P1)+1 --> after 2 units, P2 is preempted,then it must be atleast 1 unit more than B.T. of P1.

Given that P1 = 4 unit of Burst Time ===> P2 = 2+4+1 = 7

P0 = 5+7+1 = 13

0
0
@Shaik Masthan sir thanks a lot...I got it now..
0
0
yes, the answer would be 13..!

p0 =  ( 5 unit +......)

p2 = ( 2 unit +......)

p1= (4 unit ) [ completed ]

now think algo is SRTM ...
que - why P2 is preempted?

ans -  bczz P1 needs less time to complete as compared to P2 .

so P2 will be  = 2+5 =7

 

now

que - why P0 is preempted?

ans - bczz P2 needs less time to complete as compared to P0 .

so P0 = 5+8 =13
 

so answer is 13
check this one  @Shaik_Masthan
0
0
i didn't get any difference between my comment and your comment, i hope my comment and your comment are not only equivalent but also equal.... You just used different terminology.
0
0
Yes you are right ..!
0
0
i think the answer is 12 only because for the last part where p1>=p2 we will not take 5 but only 4 as in the case of same burst time process with less process id is choosen in SRTF hence we will have iS 4 and not as 5. plz notify if u find anything wrong.
2
2
@sandy

As per my knowledge, running process preempted when strictly shorter process available...

But when a process completes, STS choose a new process from Ready Queue then if Burst Time are equal then STS selects which have less process id.
0
0
@shaik, tie breaker in SRTF is arrival time not process id. we can solve this question also like-

let burst time of p0 is a and p0 runs for 5 units then p2 arrives suppose p2 burst time is b then we can say that

 b < a-5 .........................@1

now p2 runs for 2 units then p1 arrives and runs 4 time units and completes

=> 4 < b-2

=> b > 6 then min value of b is 7. put it in 1

7 < a-5 then a > 12 then minimum value of a is 13.
0
0
brother, i said, when it is Arrival time also equal,

( but i didn't mention in my comment, sorry for that )
0
0

Yes, the answer will be 13.

p0 p2 p1
13 7 4

If we take p0 = 12 BT then After 5 Unit of time p0 = 7 And p2 = 7 same BT. Then Here According to the process id 

p0 will execute again Which is against the question. So P0 will be 13.

0
0
ok got it. thanks.
0
0

Please log in or register to answer this question.