As soon as a process has been created, the system assigns it a state. A process can be in one of several states. You can view the state of the processes on a system using the ps(C) command with the -el options. The ``S'' field displays the current state as a single letter.
The important states for performance tuning are:
On single CPU systems only one process can run on the CPU at a time. All other runnable processes have to wait on the run queue.
A portion of the kernel known as the scheduler chooses which process to run on the CPU(s). When the scheduler wants to run a different process on the CPU, it scans the run queue from the highest priority to the lowest looking for the first runnable process it can find.
When a process becomes runnable, the kernel calculates its priority and places it on the run queue at that priority. While it remains runnable, the process' priority is recalculated once every second, and its position in the run queue is adjusted. When there are no higher-priority runnable processes on the run queue, the process is placed on the CPU to run for a fixed amount of time known as a time slice.
The operation of the scheduler is more sophisticated for SMP. See ``Process scheduling'' for more information.
For certain mixes of applications, it may be beneficial to
performance to adjust the way that the scheduler operates.
This is discussed in
``Adjusting the scheduling of processes''.
Main process states in a system and the transitions between them