Processes (time)

Processes (time)

Copyright(c) Management Analytics, 1995 - All Rights Reserved

Copyright(c), 1990, 1995 Dr. Frederick B. Cohen - All Rights Reserved

A process is a single sequence of instructions being executed in an order defined by the input, output, and state of the process storage areas. In UNIX, processes are generated in a tree structure by a parent process forking a child process. The parent process is essentially duplicated in the child process, and the child process can then replace its memory image with the image of a desired program. Each process has a process identifier (Pid) used by the system and other processes to identify it. The processes with Pid=0 and Pid=1 are created at system bootup, and the process with Pid=1 is the ancestor of all other processes in the system.

Each process has a process identifier created by the operating system at the creation of the process. This is normally an integer in the range from 1 to a system defined maximum. As old processes ``die'', their Pids become available to newly generated processes. Each process also has a process group that may be shared with other processes to allow them to be manipulated together, and a parent process that created it. If a parent process dies, all of its child processes are normally terminated as well, but in some cases, a parent process dies without the child process dying. In such cases, the orphan process is adopted by the process with Pid=1.

In an environment with multiple processes, there are almost always processes awaiting execution. In order to control the order of execution and assure to as high a degree as possible that each process gets a fair chance to make progress, the system has a ``scheduler'' process that determines which process to grant execution time to at each ``time slice''. In UNIX, the scheduler process is normally the process with Pid=0.

Rather than encode every system service into the operating system itself, UNIX uses system generated processes to perform processing associated with system services. This has the advantage of keeping the size of the operating system relatively small, while making it extensible to meet the needs of many environments. For example, the program that controls a printer is a process that only becomes ready to execute when a file is being sent to a printer. For two printers, you simply use two printer processes. For different sorts of printers, you change the parameters sent to the appropriate printer process.

Processes can communicate between each other through the use of interprocess communications facilities, shared memory, interprocess files called ``pipes'', signals, or regular files. Processes can be created, deleted, or modified by other processes, and a number of facilities exist for performing these operations.