Part 1 of 7 · 1 min read
Why this page comes last in the level
In this module you will
- Read the scheduling facts of a task from
ps,/procandvmstat. - Name the Linux scheduling policies and say what each is for.
- Change the policy, the priority and the processors of a task with
chrt,niceandtaskset, and withsched_setscheduler. - Explain real-time throttling and why a runaway real-time task does not freeze the machine.
- Measure wake-up latency and diagnose a machine that is busy with CPU-bound work.
Pages 1 to 6 built the theory: the measures, the policies, shares, several processors and deadlines. This page uses every one of them on a live system, and each claim here was checked by a run on a two-processor machine with kernel 6.18. Nothing new is introduced in theory. The aim is to be able to look at a slow Linux machine and say which of the ideas explains it. The sources are "The Linux Programming Interface" (TLPI), chapter 35, "Operating Systems: Three Easy Pieces" (OSTEP), chapters 7 to 10, the manual pages sched(7), chrt(1) and nice(1), and the kernel documentation of the EEVDF scheduler.
About this example About this example
Real: The C programs, commands and outputs on this page were compiled with gcc -Wall -Wextra -pthread and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39).
Scripted: The worked traces use small numbers chosen so they can be followed by hand.
Not real: The page simplifies real systems. Actual kernels add more cases, limits and tuning than a short page can show.