Quick Jumps:
|
Guide Navigation:
|
Processes
Just as the file is the base unit of data storage on a UNIX system, the process
is the base unit of software. A process has its own execution and memory
address space on the system, and is treated as an individual entity by the UNIX
operating system. It's important to note that a program (like
ls or cd)
is not the same thing as a process - a program can contain many processes.
If you can find a grizzled old timer who used computer systems in the 1960s and
early 1970s, they can tell you about the batch-oriented operating systems that
predated UNIX. A batch operating system could only execute one task at a time,
so users literally had to stand in line and wait their turn to use the processor.
UNIX is a multitasking operating system, which means it can perform multiple
tasks simultaneously. At any given time, an average UNIX system may be
performing anywhere from 5 to 50,000 tasks simultaneously. This magic is
actually rather simple - UNIX quickly switches between every process on the
system, giving each one a short period of time (called a time slice) to execute.
Some very simple processes can finish in one time slice; more complex ones can
take millions upon millions of time slices to complete.
More important processes can be given time slices more often than less important
processes through a system called priority scheduling. For example, a process
that writes memory buffers to disk is much more important than the process that
transmits an email message. For the most part UNIX takes care of itself when it
comes to priority scheduling - the system is smart enough to know which
processes should be given a higher priority. A user can reduce (but not
increase) the priority of a process that they have started. Usually this is
done by more advanced users on a system who are running a process that can take
hours or even days to complete. Instead of slowing down the system for other
users, the long-running process only runs during periods of relative system
inactivity. While it may take the process an additional hour or two to complete
because of its reduced priority level, it keeps the system running at peak
efficiency for other users.
The root user has the privileges to alter the priority of any process on the
system. Most often this is used when a rogue process tries to take much more
than its fair share of execution time. By reducing the process's priority, the
system administrator can keep the system usable for other users. On occasion,
the system administrator may be performing an important time-sensitive operation
that needs to be completed as quickly as possible. When the situation warrants
it, the system administrator can increase the priority of a process to speed up
its execution. For information on how to change the priority of a process, see
the section on managing processes in Chapter 8.
|