operating-systems

Definition

Process Termination

Process termination ends a process’s execution. The OS reclaims all resources and removes its entry from the process table.

Triggers

Normal Completion

Process executes its final instruction (e.g., exit() call).

User Logout

Ending a session terminates associated processes.

Error/Exception

Fatal error occurs (segmentation fault, division by zero).

Killed by Parent

Parent process terminates a child process.

Killed by OS

OS terminates process due to resource exhaustion or security violations.

Steps

Termination Sequence

  1. Protocolling: OS records final resource usage (e.g., CPU time) for billing/logging
  2. Reclaim Resources: Files closed, memory freed
  3. Notify Parent: OS sends signal to parent process
  4. Cleanup: PCB and process table entry deleted