System information
168 System Analysis and Tuning Guide
The scheduler calculates the timeslices dynamically. However, to determine the ap-
propriate timeslice is a complex task: Too long timeslices cause the system to be less
interactive and responsive, while too short ones make the processor waste a lot of time
on the overhead of switching the processes too frequently. The default timeslice is
usually rather low, for example 20ms. The scheduler determines the timeslice based
on priority of a process, which allows the processes with higher priority to run more
often and for a longer time.
A process does not have to use all its timeslice at once. For instance, a process with
a timeslice of 150ms does not have to be running for 150ms in one go. It can be run-
ning in five different schedule slots for 30ms instead. Interactive tasks typically ben-
efit from this approach because they do not need such a large timeslice at once while
they need to be responsive as long as possible.
The scheduler also assigns process priorities dynamically. It monitors the processes'
behavior and, if needed, adjusts its priority. For example, a process which is being
suspended for a long time is brought up by increasing its priority.
14.4 Completely Fair Scheduler
Since the Linux kernel version 2.6.23, a new approach has been taken to the sched-
uling of runnable processes. Completely Fair Scheduler (CFS) became the default
Linux kernel scheduler. Since then, important changes and improvements have been
made. The information in this chapter applies to SUSE Linux Enterprise Server with
kernel version 2.6.32 and higher (including 3.x kernels). The scheduler environment
was divided into several parts, and three main new features were introduced:
Modular Scheduler Core
The core of the scheduler was enhanced with scheduling classes. These classes are
modular and represent scheduling policies.
Completely Fair Scheduler
Introduced in kernel 2.6.23 and extended in 2.6.24, CFS tries to assure that each
process obtains its “fair” share of the processor time.
Group Scheduling
For example, if you split processes into groups according to which user is running
them, CFS tries to provide each of these groups with the same amount of proces-
sor time.