Process Creation vs Process Termination in Operating System
Process Creation and Process termination are used to create and terminate processes respectively. Details about these are given as follows −
A process may be created in the system for different operations. Some of the events that lead to process creation are as follows −
- User request for process creation
- System Initialization
- Batch job initialization
- Execution of a process creation system call by a running process
A process may be created by another process using fork(). The creating process is called the parent process and the created process is the child process. A child process can have only one parent but a parent process may have many children. Both the parent and child processes have the same memory image, open files and environment strings. However, they have distinct address spaces.
A diagram that demonstrates process creation using fork() is as follows −
Process termination occurs when the process is terminated The exit() system call is used by most operating systems for process termination.
Some of the causes of process termination are as follows −
- A process may be terminated after its execution is naturally completed. This process leaves the processor and releases all its resources.
- A child process may be terminated if its parent process requests for its termination.
- A process can be terminated if it tries to use a resource that it is not allowed to. For example - A process can be terminated for trying to write into a read only file.
- If an I/O failure occurs for a process, it can be terminated. For example - If a process requires the printer and it is not working, then the process will be terminated.
- In most cases, if a parent process is terminated then its child processes are also terminated. This is done because the child process cannot exist without the parent process.
- If a process requires more memory than is currently available in the system, then it is terminated because of memory scarcity.
Published on 11-Oct-2018 01:33:27