Glossary

Orphan Process

An orphan is a process whose parent has terminated while the child is still running. Orphans are not errors: the kernel simply reparents them to PID 1 (or a designated subreaper), which takes over the responsibility of reaping them when they eventually exit. From the orphan's perspective, nothing happens except that its getppid() now returns 1.

Orphaning is the mechanism behind daemonisation: a program starts, forks a child, and exits the parent. The child, now orphaned, is adopted by init and becomes a background daemon independent of the invoking shell.

If a process's PPID is 1, the process has been orphaned. This is different from a zombie: zombies are already dead and waiting to be reaped, while orphans are alive but have lost their original parent. Modern Linux supports subreapers (set via prctl(PR_SET_CHILD_SUBREAPER)): a process can declare that descendants whose parents die should be reparented to it rather than to PID 1. Systemd uses this to keep services' grandchildren within their own unit, which is how session-wide cleanup works.

Related terms: Zombie Process, Process, init

Discussed in:

Also defined in: Textbook of Linux