Skip to main content
InterviewHubPRO
Section Overview
Q14

Question 14 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

28%
Linux OS Internals (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

How does the Completely Fair Scheduler (CFS) allocate CPU time?

senior LevelSystem Design

In Simple Words: CFS is the default Linux CPU scheduler for standard processes:

  • Models an "ideal multi-tasking CPU" where every process gets a fair slice of CPU time.
  • Uses a Red-Black Tree ordered by vruntime (Virtual Runtime): the amount of CPU execution time the process has received.
  • The scheduler always picks the task with the smallest vruntime (leftmost node in the tree).
  • Nice Values (-20 to +19): Lower nice values (e.g. -20 = highest priority) slow down the accumulation of vruntime, giving the task more CPU time.