9 THE INITIAL STATE OF A PROCESS

There can be little argument that it is desirable to control fully the initial state of a process. However, there are at least two ways of achieving this. One is to allow the system linker to create a fully specified process image in a file, and for the loader to load the image, exactly as specified, into memory. Another way, taken by UNIX, is to duplicate the current image of a process when it creates a subprocess, and also to allow a process (usually a new subprocesses) to replace its current image with one specified in a file.

However, creating a new process by duplicating the memory image of the parent process is not sensible if the subprocess immediately replaces the image with one from a file (by far the most common case). Furthermore, such an unnecessary duplication can be very expensive operation if the image must be copied from one physical memory to another via a network.

Once a new process is created, it can either immediately start executing, as is the case for a UNIX process, or it can remain in a suspended state until explicitly started by its parent process. Such an initial suspension allows a parent process to create several subprocesses, and to set up communication links between them, while they are in a known state. A parent can also connect the communication ports of subprocesses to servers, files, or devices, or transfer the use of some of its own communication links to subprocesses. Initial suspension is thus preferable.

Another initialization issue concerns the interface of a new process to its environment. A new UNIX process inherits copies of all the file descriptor of its parent. This is fine when the descriptors provide read-only access to actual files. However, if one of the file descriptors represents a terminal and both parent and child use it simultaneously, chaos results. In the operating system designed by the author, the UNIX concept of a file descriptor is superceded by a generalized ``communication link'', and it can be both complicated and undesirable automatically to provide a new process with duplicates of all the communication links of its parent. Consequently, a new process is created without any communication links, and it is up to its parent explicitly to provide the links that the new process expects to be able to use without establishing them itself.


next up previous
Next: 10 RATE OF EXECUTION Up: No Title Previous: 8 CONTROL BY EXTERNAL

Prof Herman Venter
Tue May 7 09:30:30 GMT 1996