Practice free →
HomeGATE CSEcomputerscienceOperating Systems › STCF runs job A (100) at t=0, but at t=10 jobs B…

STCF runs job A (100) at t=0, but at t=10 jobs B (10) and C (10) arrive. What does STCF do?

Acontinues running A to completion (non-preemptive)
Bpreempts A and runs B (or C), since their remaining time is shorter
Cruns A and B in parallel on the same CPU
Daborts A and discards it
Answer & Solution
Correct answer: B. preempts A and runs B (or C), since their remaining time is shorter
1. STCF is PREEMPTIVE. At every scheduling decision (e.g. when a new job arrives), it compares the REMAINING time of the running job to the new jobs' run times. 2. At t=10: A has 90 remaining; B and C each have 10. So STCF PREEMPTS A and runs B (then C, then A). 3. Schedule: A runs 0-10, B 10-20, C 20-30, A 30-120. 4. Turnaround: A=120, B=20, C=30. Average = $(120+20+30)/3 \approx 56.7$. 5. Compare to non-preemptive SJF which would NOT have preempted A — A would have run 0-100, then B 100-110, then C 110-120 → avg = $(100+110+120)/3 = 110$ (same as FIFO!). 6. So STCF's preemption is key. Option A describes SJF, not STCF. _Source: OSTEP Ch 7, §7.5 (STCF — preemption example), p. 5-6._
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions