Bird
Raised Fist0

Which process runs at time 3?

easy🧠🧾 Concept Trace Q12 of Q15
Operating Systems - Shortest Job First (SJF) - Preemptive vs Non-Preemptive
Trace the sequence of process execution in preemptive SJF scheduling when the following processes arrive: P1(Arrival=0, Burst=8), P2(Arrival=1, Burst=4), P3(Arrival=2, Burst=2). Which process runs at time 3?
AP2
BP1
CP3
DCPU is idle
Step-by-Step Solution
  1. Step 1: At time 0

    Only P1 has arrived, so P1 starts running.
  2. Step 2: At time 1

    P2 arrives with burst 4, which is less than P1's remaining 7, so preemption occurs and P2 runs.
  3. Step 3: At time 2

    P3 arrives with burst 2, less than P2's remaining 3, so preemption occurs and P3 runs.
  4. Step 4: At time 3

    P3 has run 1 unit (remaining 1), P2 and P1 are waiting. Since P3 has the shortest remaining time, it continues running.
  5. Final Answer:

    Option C -> Option C
  6. Quick Check:

    At time 3, the shortest remaining burst is P3's 1 unit, so P3 runs.
Quick Trick: At each arrival, pick the process with the shortest remaining burst [OK]
Common Mistakes:
MISTAKES
  • Not preempting when a shorter job arrives
  • Assuming the first process continues until completion
Trap Explanation:
PITFALL
  • Option B is tempting because P2 arrived before P3, but preemptive SJF always picks the shortest remaining time, so P3 runs at time 3.
Interviewer Note:
CONTEXT
  • Tests candidate's ability to mentally simulate preemptive SJF scheduling step-by-step.
Master "Shortest Job First (SJF) - Preemptive vs Non-Preemptive" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes