Gabor Toth Blog

Completely Fair Scheduling

The red-black magic of Linux

Linux scheduling lies at the heart of how the kernel manages time and resources. It ensures that every process—from real-time tasks to background jobs—gets a fair share of CPU time. The scheduler must constantly balance performance, responsiveness, and fairness across diverse workloads.

While Linux supports multiple schedulers, its default and most widely used is the Completely Fair Scheduler (CFS). This post dives into how CFS works and the red-black tree magic behind its design.


Build and boot Linux

Simple build for aarch64 and booting with QEMU

Why Linux?

Nowadays, in the market of operating systems – including embedded devices – Android is leading by a wide margin. In January 2025, it reached a market share of 46.18%, while the second-place contender, Windows, held just over half of that, at 25.46%. Since the core of the Android operating system is the Linux kernel, it can be stated that Linux-based systems run on nearly half of all the devices.