DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Tuning CPU resources

Process states

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:


O
On processor -- the processor is executing on the CPU in either user or system mode.

R
Runnable -- the process is on a run queue and is ready-to-run. A runnable process has every resource that it needs to execute except the CPU itself.

S
Sleeping -- the process is waiting for some I/O event to complete such as keyboard input or a disk transfer. Sleeping processes are not runnable until the I/O resource becomes available.
``Main process states in a system and the transitions between them'' represents these process states and the possible transitions between them.

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



Next topic: Clock ticks and time slices
Previous topic: Viewing CPU activity

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003