Objective 6: Modify Process Execution Priorities

Part of Linux’s flexibility is to let users and administrators prioritize process execution. This feature is handy when you have a high-load machine and want to make sure special processes (like yours!) get more rights to use system resources than others. It also is useful if you have a process that’s gone haywire and you want to debug the problem prior to killing it. On the flip side, you can bury nonessential processes, giving them the lowest priority so they don’t ever conflict with other processes.

Generally, on a day-to-day basis, you don’t need to worry about execution priority, because the kernel handles it automatically. Each process’s priority level is constantly and dynamically raised and lowered by the kernel according to a number of parameters, such as how much system time it has already consumed and its status (perhaps waiting for I/O; such processes are favored by the kernel). Linux gives you the ability to bias the kernel’s priority algorithm, favoring certain processes over others.

The priority of a process can be determined by examining the PRI column in the results produced from issuing either the top or ps -l commands. The values displayed are relative; the higher the priority number, the more CPU time the kernel offers to the process. The kernel does this by managing a queue of processes. Those with high priority are given more time, and those with low priority are given less time. On a heavily loaded system, a process ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.