In this chapter and the next, you will dive into the details regarding a key OS topic – that is, CPU scheduling on the Linux OS. I will try and keep the learning more hands-on, by asking (and answering) typical questions and performing common tasks related to scheduling. Understanding how scheduling works at the level of the OS is not only important from a kernel (and driver) developer viewpoint, but it will also automatically make you a better system architect (even for user space applications).
We shall begin by covering essential background material; this will include the Kernel Schedulable Entity (KSE) on Linux, as well as the POSIX scheduling policies that Linux implements. We will then move on to using tools – perf and others – to visualize the flow of control as the OS runs tasks on CPUs and switches between them...