recategorized by
5,917 views
0 votes
0 votes

Consider three CPU intensive processes $P1, P2, P3$ which require $20, 10$ and $30$ units of time, arrive at times $1, 3$ and $7$ respectively. Suppose operating system is implementing Shortest Remaining Time first (preemptive scheduling) algorithm, then _____ context switches are required (suppose context switch at the beginning of Ready queue and at the end of Ready queue are not counted).

  1. $3$ 
  2. $2$
  3. $4$
  4. $5$
recategorized by

3 Answers

2 votes
2 votes

p1 ,p2, p3 are three process  

Arrival time of p1 is 1 so we made to run p1 at time 1

now p1 is run for 2 units ( upto 3) new process arrived with less B.T ,so switch happens to p2 ----- (1)

p2 run till completion since there are no shorter jobs available ,then switch happens to p1---- (2)

again p1 is run since it has burst time ( 18 ) < burst time of p3 ( 30 )

completion of p1, switch happens to p3  run till completion.                                               ----- (3)

0 votes
0 votes
If we consider .and start from 0 then c.s is 4 in question not mention ..so default start from 0 is it correct or wrong plz .look

Related questions