Process Hierarchies

Process Hierarchies

In some systems, when a process creates another process, the parent process and child process continue to be connected in certain ways. The child process can itself create more processes, forming a process hierarchy. Note that unlike plants and animals that use sexual reproduction, a  process has only one parent (but zero, one, two, or more children).

In UNIX, a process and all of its children and further descendants together form a process group. When a user sends a signal from the keyboard,  the signal is delivered to all members of the process group currently connected with the keyboard (generally all active processes that were created in the current window). Individually, each process can catch the signal, ignore the signal, or take the default action, which is to be killed by the signal.

As another instance of where the process hierarchy plays a role, let us look at how UNIX initializes itself when it is started. A special process, called init, is present in the boot image. When it starts running, it reads a file telling how many terminals there are. Then it forks off one new process per terminal. These processes wait for someone to log in. If a login is successful, the login process performs a shell to accept commands. These commands may start up more processes, and so forth. Therefore, all the processes in the whole system belong to a single tree, with init at the root.

On the contrary, Windows has no concept of a process hierarchy. All processes are equal. The only hint of a process hierarchy is that when a process is created, the parent is given a special token (called a handle) that it can use to control the child. However, it is free to pass this token to some other process, as a result invalidating the hierarchy. Processes in UNIX cannot disinherit their children.


Tags

process, unix, file system