Linux CFS Scheduler | OS Interview | Skill-Lync Resources
Hard Operating Systems CPU Scheduling

Explain the Completely Fair Scheduler (CFS) in Linux.

Answer

CFS aims for ideal multitasking where each process gets equal CPU time. Uses red-black tree keyed by virtual runtime (vruntime). Process with smallest vruntime runs next. When running, vruntime increases; lower priority means faster increase. Sleeping processes don't accumulate vruntime, so they get priority when waking. No fixed timeslices - scheduling granularity based on number of runnable tasks. Achieves O(log n) scheduling decisions. Replaced O(1) scheduler in Linux 2.6.23.

Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

OS Developer Systems Developer Performance Engineer