Process Termination in operating systems

Process Termination in operating systems

Process termination is a technique in which a process is terminated and release the CPU after completing the execution.

Most of the OS use exit( ) system call to terminate a process.

Main causes of process termination

Normal Completion:

The process completes all task and releases the CPU.

Protection Error:

Process wants to use a resource that is not allowed to use by that process. For example; If a process wants to WRITE on a file that is READ ONLY file.

I/O Failure:

When a process attempts to use an I/O device and I/O device is not working fine at the moment. For example, a process that wants to print a file on the printer, but the printer is defective.

Parent Request:

If a parent process request for terminating the child process. Then, the child process should be terminated.

Parent Termination:

When the parent is not in CPU, child process can’t exist in CPU. Soo when a parent is terminated, child process also needs to be terminated.

Time Over Run:

Waiting time is specified for a  process that for how much time a process can wait for a resource. In this time if the process fails to allocate a resource then the process needs to be terminated.

Arithmetic Error:

There is an instruction of a process that is invalid instruction, the process needs to be terminated. For example, if a process wants to divide a number by zero.

Memory Requirement:

A process requires more memory to execute but the system fails to provide enough memory to the process for its execution, then the process needs to be terminated.

Privileged Instruction:

Process try to execute an instruction that is reserved for only  OS.

OS Involvement to terminate:

In some critical cases, OS take the control of the process and stops the execution of the process. For example, if a deadlock occurs, or deadlock can occur, then OS terminates the process.