7 Processes
The previous chapter traced the developments which occur after “the operating system has been rebooted”, and in so doing introduced a number of significant features of the process concept. One of the aims of this chapter is to go back and re-explore some of the same ground more thoroughly.
There are a number of serious difficulties in providing a generally acceptable definition of “process”. These are akin to the difficulties faced by the philosopher who would answer “what is life?” We will be in good company if we brush the more subtle points lightly aside.
The definition for “process” already given, “a program in execution”, does reasonably well in suggesting what is intended. However it does not fit the case of either process #0 throughout its life or process #1 during its first moments. All other processes in the system however are clearly associated with the execution of some program file or other.
Processes can be introduced into discussions of operating systems at two levels.
At the upper level, “process” is an important organising concept for describing the activity of a computer system as a whole. It is often expedient to view the latter as the combined activity of a number of processes, each associated with a particular program such as the “shell”, or the “editor”. A discussion of UNIX at this level is given in the second half of Ritchie’s and Thompson’s paper, “The UNIX Time-sharing System”.
At this level the processes themselves are considered to be the active entities in the system, while the identities of the true active elements, the processor and the peripheral devices, are submerged: the processes are born, live and die; they exist in varying numbers; they may acquire and release resources; they may interact, cooperate, conflict, share resources; etc.
At the lower level, “processes” are inactive entities which are acted on by active entities such as the processor. By allowing the processor to switch frequently from the execution of one process image to another, the impression can be created that each of the process images is developing continuously and this leads to the upper level interpretation.
Our present concern is with the low level interpretation: with the structure of the process image, with the details of execution and with the means for switching the processor between processes.
The following observations may be made about processes in the UNIX context:
- (a)
the existence of a process is implied by the existence of a non-null structure in the “proc” array, i.e. a “proc” structure for which the element “p_stat” is non-null;
- (b)
for each process there is a “per process data area” containing a copy of the “user” structure;
- (c)
the processor spends its entire life executing one process or another (except when it is resting between instructions);
- (d)
it is possible for one process to create or destroy another process;
- (e)
a process may acquire and possess resources of various kinds.