What is process termination?

A process is a program in execution and it is more than a program code called as text section and this concept works under all the operating system because all the task perform by the operating system needs a process to perform the task

The process executes when it changes state. The state of a process is defined by the current activity of the process.

Each process may be any one of the following states −

  • New − The process is being created.

  • Running − In this state the instructions are being executed.

  • Waiting − The process is in waiting state until an event is occur like I/O operation completion or receiving a signal.

  • Ready − The process is waiting to be assigned to a processor.

  • Terminated − the process has finished execution.

It is important to know that only one process can be running on any processor at any instant. Many processes may be ready and waiting.

Operations on Process

The two main operations perform on Process are as follows −

  • Process creation

  • Process termination

Now let us see about process termination.

Process Termination

Whenever the process finishes executing its final statement and asks the operating system to delete it by using exit() system call.

At that point of time the process may return the status value to its parent process with the help of wait() system call.

All the resources of the process including physical and virtual memory, open files, I/O buffers are deallocated by the operating system.

Reasons for process termination

The reasons that the process may terminate the execution of one of its children are as follows −

  • The child exceeds its usage of resources that it has been allocated.

  • The task that is 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.

Some systems, including VMS, do not allow a child to exist if its parent has terminated. In such systems, if a process terminates either normally or abnormally, then all its children have to be terminated. This concept is referred to as cascading termination.

Causes for termination

The other causes for termination are as follows −

  • Time slot expired − When the process execution does not complete within the time quantum, then the process gets terminated from the running state. The CPU picks the next job in the ready queue to execute.

  • Memory bound violation − If a process needs more memory than the available memory.

  • I/O failure − When the operating system does not provide an I/O device, the process enters a waiting state.

  • Process request − If the parent process requests the child process about termination.

  • Invalid instruction