ISRO Scientist/Engineer CSE 2020Operating Systems › Process Scheduling
ISRO Scientist/Engineer CSE 2020 PYQ: Three CPU-bound tasks, with execution times of 15,12 and 5 time units respectively arrive at times $0,t$ and…
Three CPU-bound tasks, with execution times of 15,12 and 5 time units respectively arrive at times $0,t$ and 8, respectively. If the operating system implements a shortest remaining time first scheduling algorithm, what should be the value of $t$ to have 4 context switches? Ignore the context switches at time 0 and at the end.
- A$0<t<3$Correct answer
- B$t=0$
- C$t<=3$
- D$3<t<8$
Answer
(A) $0<t<3$
Approach
For P2 to preempt P1 at time t, P2's burst (12) must be less than P1's remaining time (15−t), so t<3. At time 8, P3 causes a further preemption only if P2 still has more than 5 units left; the exact 4-switch interval is 1<t<3, since for t<1 P2 finishes before P3 can preempt and only 3 switches occur. Among the given choices, A (0<t<3) is the intended/best option and certainly includes the verified t=2 case; B, C, and D contain no valid subcase or are otherwise inconsistent with 4 switches.
Reviewed by ISRO IQ Editorial Team.