Process termination when it finishes its execution by executing the final statement and request to the operating system delete it by using exit() system call. At this point the process may return output data to its parent process via the wait system call. All the resources of the process including open files, physical and virtual memory and I/O operations are deallocated by operating system return back. Termination of process can be occurring in some additional circumstances, using a specific system call such as abort a process can cause the termination of another process. Generally, this kind of system call can be invoked by the parent process only that is to be terminated. Otherwise users could subjectively kill each other’s jobs. The parent requires to know the identities of its children. Whenever a process creates a new process the parent process passed the newly created process’s identity. There are various reasons to terminate the execution of its child processes such as:
- The task that is assigned to the child is no longer required.
- The child process exceeded to its usage of the specific resources that are assigned to it.
- If the parent process terminated the operating system does not allow it child process to continue its execution.
- If a process terminated either normally or abnormally then all of its child processes must also be terminated.
- The above phenomenon is called as cascading termination which is usually initiated by the operating system.
To demonstrate the process execution and termination the exit() system call is used to terminate the process execution and its parent process may wait for that event by using the wait system call. The wait system call proceeds the process identifier of a terminated child so that the parent can tell which child process of the possibly many children has terminated. If the parent process terminated, then all of its child processes have assigned as new parent however the child processes still have a parent to accumulate their status and execution statistics. Process can be independed or depended. Process cooperation is discussed in operation on processes topic by the name of cooperating processes. However, there are various reasons for providing an environment that allows process cooperation.
- Information Sharing: There can be a case that several users may be interested in the same piece of information.
- Computation Speedup: To make a specific task to run faster it can be divided into subtasks each of which can be executed concurrently. Computation speedup can be achieved by using the computer which has multiple processing elements.
- Modularity: It can be achieved by dividing the system functions into separate processes or threads.
- Convenience: Each and every user can work on many tasks simultaneously.
Cooperating processes need IPC which is discussed in detail in topic operations on processes communication models are given here as message passing and shared memory.