System information
166 System Analysis and Tuning Guide
14.1.1 Preemption
The theory behind task scheduling is very simple. If there are runnable processes in
a system, at least one process must always be running. If there are more runnable
processes than processors in a system, not all the processes can be running all the
time.
Therefore, some processes need to be stopped temporarily, or suspended, so that oth-
ers can be running again. The scheduler decides what process in the queue will run
next.
As already mentioned, Linux, like all other Unix variants, is a multitasking operating
system. That means that several tasks can be running at the same time. Linux provides
a so called preemptive multitasking, where the scheduler decides when a process is
suspended. This forced suspension is called preemption. All Unix flavors have been
providing preemptive multitasking since the beginning.
14.1.2 Timeslice
The time period for which a process will be running before it is preempted is defined
in advance. It is called a process' timeslice and represents the amount of processor time
that is provided to each process. By assigning timeslices, the scheduler makes global
decisions for the running system, and prevents individual processes from dominating
over the processor resources.
14.1.3 Process Priority
The scheduler evaluates processes based on their priority. To calculate the current
priority of a process, the task scheduler uses complex algorithms. As a result, each
process is given a value according to which it is “allowed” to run on a processor.
14.2 Process Classification
Processes are usually classified according to their purpose and behavior. Although the
borderline is not always clearly distinct, generally two criteria are used to sort them.
These criteria are independent and do not exclude each other.