
When a process creates a new process, two possibilities exist in terms of execution:
� The parent continues to execute concurrently with its children.
� The parent waits until some or all of its children have terminated.
There are also two possibilities in terms of address space of the new process:
� The child process is a duplicate of the parent process.
� The child process has a program loaded into it.
As an illustration for implementation, let�s take UNIX operating system. In UNIX, each process is identified by its process identifier, which is a unique integer. A new procedure is created by the fork system call. The new procedure consist of a copy of the address space in memory of the original procedure. This mechanism allows the parent process to establish a smooth two way communication with its child procedure. Both parent and child procedure continue execution at the instruction after the fork with one difference: The return code for the fork is zero for the new (child) process, whereas the (nonzero) process identifier of the child is returned to the parent.
The parent also can create more children, or, if it has nothing else to do while the child runs, it can issue a wait system call to move itself off the ready queue until the termination of the child.
An additional way that a process can cause the termination of its process or another process is by the use of the system call abort, which can only be invoked by the parent of the process that needs to be terminated. This avoids that users could kill other�s jobs. But in order to avoid any confusion a parent must know its children identities very well. Thus when one process creates a new process, the identity of the newly created process is passed to the parent. Some of the reasons for which a parent may terminate the execution of one of its children may vary, a few are:
� The child has exceeded its usage of the resources that it has been allocated.
� The task assigned to the child is no longer required.
� The parent is exiting, and the operating system does not allow a child to continue if its parent terminates.
We can use UNIX system again to illustrate the process termination better. In UNIX a child process may be terminated by using the exit system call, and its parent process may wait for such event to occur by using the wait system call. Once the child has been terminated, the wait system call returns the process identifier of such terminated child, allowing the parent to know which of its many children has been terminated. In the case that the parent is terminated, all the children will also be terminated by the operating system, because without a parent UNIX will not be able to report the activities of a child.

| LinkExchange Member | Free Home Pages at GeoCities |
