Skip to content
Optimal Lab

Operating systems · interactive

CPU scheduling

One core, four programs that want it. The scheduler decides who runs next, and that choice changes how long each one waits, even though the total work is identical.

The core over time (0–23)

P1P2P3P4
processarrivesneedsdone atwaited
P10880
P214127
P3292110
P4322318

Average wait 8.75 · average turnaround 14.50 · context switches 3

First come, first served: average wait 8.75 time units.

Policy

  1. 1

    Simple and fair in order of arrival. A long job at the front makes everyone behind it wait.

    avg wait 8.75

  2. 2

  3. 3

  4. 4

In production

Tools and technologies

Every OS has a scheduler; you mostly influence it through priorities and limits.

Not tied to one language — use these names when you search docs or design a system.