Linux uses a preemptive, priority-aware fair scheduler for normal tasks. The Completely Fair Scheduler (CFS) tracked each task's virtual runtime and always ran the task with the least of it (kept in a red-black tree), weighted by nice values; newer kernels (6.6 and later) use EEVDF, a related fair scheduler that also considers latency.
Real-time tasks use separate policies (SCHED_FIFO and SCHED_RR) that take priority over normal tasks, and each core has its own run queue with load balancing across cores.
Nice values range from -20 (highest priority) to 19 (lowest).
Loading…