AlgoViz
← Back to trail

CPU Scheduling (FCFS)

Medium+14 XP

Watch a Gantt chart fill in as the simplest scheduler runs jobs first-come, first-served — and see its flaw.

No visualization loaded.

Watch

i

Press Run to begin.

There's one CPU but many processes that want it. The scheduler decides whose turn it is. Press Run to watch the simplest rule — First-Come-First-Served — build its timeline, and spot why it isn't always fair.

How do I read this chart?

Each ROW is a process; each COLUMN is one tick of time. A colored box in row P2, column 5 means 'P2 was using the CPU during time-slice 5.' Reading left to right shows you exactly who ran when — that's a Gantt chart.

What does First-Come-First-Served mean?

Exactly what it says: whoever asked first goes first, and runs all the way to the end before the next one gets a turn — like a single queue at a shop where nobody is allowed to cut in, and the cashier finishes one customer completely before starting the next.

What's the 'convoy effect' / why is FCFS not great?

If a big slow job is at the front, everyone behind it waits a long time — even if they only needed a second. Like getting stuck behind one person with a giant cart while you're holding a single item. FCFS is simple but can make short jobs wait far too long.

What's the fix?

Other schedulers! Round-Robin gives each process a small time-slice and rotates, so no one job hogs the CPU. Shortest-Job-First runs the quick ones first. Round-Robin is the very next topic — this FCFS chart is the baseline to compare against.

🧠A scheduler decides which process gets the one CPU. First-Come-First-Served runs jobs in arrival order, start to finish — dead simple, but a big job at the front makes everyone wait (the convoy effect).
P1 runningP2 runningP3 running