$linuxjunkies
>

orphan process

A process whose parent process has terminated before it does. The orphan is automatically adopted by the init process (PID 1), which becomes responsible for reaping it when it exits.

When a process terminates, the kernel notifies its child processes by changing their parent process ID (PPID) to 1, making them children of init. This happens automatically to prevent zombie processes from accumulating in the process table.

Orphaning can occur intentionally or accidentally. For example, if you start a long-running process in a shell and then close that shell without waiting for the process to finish, that process becomes an orphan. The init process ensures these orphaned children are properly cleaned up when they exit.

Example: Running nohup long_task & in a terminal and then closing the terminal creates an orphan process. The command continues running because init adopts it and handles cleanup.

Related terms