@MiNiPanda nice and precise explanation thanks

The Gateway to Computer Science Excellence

+2 votes

Consider 3 processes *P*_{0}, *P*_{1} and *P*_{2} to be scheduled as per the SRTF algorithm. The process ‘*P*_{0}’ is known to be scheduled first and when ‘*P*_{0} has been running ‘6’ units of time, then the process ‘*P*_{2}’ has arrived. The process ‘*P*_{2}’ has run for ‘4’ unit of time,then the process ‘*P*_{1}’ has arrived and completed running in ‘5’ units of time. Then the minimum burst time of ‘*P*_{0}’ is _______ (in units).

Please explain how to solve this. Ans is given 17

+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.

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.

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.

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.

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

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,366 answers

198,496 comments

105,265 users