operating-systems

Definition

Process Termination

Process termination is the act of ending a process’s execution. Upon termination, the operating system reclaims all resources assigned to the process and removes its entry from the Process Table.

Triggers

A process may terminate for several reasons:

  • Normal Completion: The process executes its final instruction (e.g., exit() call).
  • User Logout: The user ending their session terminates associated processes.
  • Error/Exception: A fatal error occurs, such as a segmentation fault or division by zero.
  • Killed by Parent: A parent process ends a child process.
  • Killed by OS: The OS terminates a process due to resource exhaustion or security violations.

Final Steps

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