DSA Factory
Free CPU scheduling lessonsCPU scheduling · Stage 1 · Shortest first · Step 2

Shortest remaining time first

Let a shorter arrival interrupt the running process, and weigh the better averages against more switching. About 13 minutes.

Quick check

P1 has 5 units left when P2 arrives needing 4. What does SRTF do?

  1. AP2 preempts P1, which goes back to the ready queue with 5 left
  2. BP2 waits until P1 finishes
  3. CP1 restarts from the beginning later
Show the answer

P2 preempts P1, which goes back to the ready queue with 5 left. 4 is less than 5, so the newcomer has the shortest remaining time.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve