Frequently Asked Question

What does the process scheduler actually do?

A CPU can run one thread at a time. The scheduler decides which runnable thread runs next and for how long, and switches them in and out fast enough that everything seems to run at once. Linux's default scheduler is the Completely Fair Scheduler (CFS), introduced in 2.6.23 and replaced in 2024 by EEVDF (Earliest Eligible Virtual Deadline First); both aim to give each runnable task a fair slice of CPU time weighted by its priority (nice value).

Real-time tasks bypass CFS/EEVDF and use SCHED_FIFO or SCHED_RR, which run them to completion or in round-robin order at higher priority. You can see what each thread is using with top, htop, or ps -eLo pid,tid,policy,pri,comm.

Video

Further reading and video