Free — no signup required

The Default: Completely Fair Scheduler (CFS)

2 min read

The Pursuit of Fairness

For the vast majority of processes on any Linux system — your shell, your web server, your database — the scheduler in use is the Completely Fair Scheduler (CFS), introduced in Linux kernel 2.6.23 (2007). Its goal is right in the name: fairness.

CFS tries to model an "ideal, perfect multitasking CPU." Imagine a CPU that could split its processing power infinitely. If you had 5 running processes, this ideal CPU would give exactly 20% of its power to each of them simultaneously. Real hardware cannot do that — you cannot run two instructions on the same core at the same instant. So CFS approximates this ideal by tracking how much CPU time each process has received and always giving the CPU to whichever process has received the least.

The practical result: no runnable process starves. A background log-rotation job and a foreground web server both make progress, just at rates proportional to their configured weights (more on that below). CFS replaced the older O(1) scheduler, which used fixed time slices and had known fairness problems under certain workloads.

Interview Tip

Interviewers often ask: "What scheduler does Linux use by default, and what problem does it solve?" The answer is CFS, and the problem it solves is starvation — ensuring every runnable process eventually gets CPU time. A follow-up question is often: "How does CFS differ from a simple round-robin scheduler?" The key distinction is that CFS uses weighted virtual runtime rather than fixed time slices, so processes with different priorities still get proportionally fair treatment rather than equal raw time.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free