PID 1 is the first user-space process the kernel starts at boot. It is usually systemd or another init system (the program that starts and manages the other services). It has three special roles.
1. It adopts orphans. When a process's parent dies, the orphan gets PID 1 as its new parent. The exception is when a closer subreaper exists (a process that asked to adopt orphans in its subtree). So PID 1 must keep calling wait() to reap these children, which means collecting their exit status. If it doesn't, zombies pile up.
2. The kernel protects it from signals. Inside its PID namespace, PID 1 only receives signals it has installed a handler for. So a stray kill -TERM 1 does nothing, unless init chose to handle SIGTERM. This stops someone from bringing down the system by accident.
3. It must never exit.
- If init dies on the host, the kernel panics (the whole system crashes).
- If the init of a PID namespace exits, for example inside a container, the kernel kills every other process in that namespace.
- PID 1 is the first user-space process, and the kernel starts it at boot.
- PID 1 adopts orphan processes and must reap them.
- Inside its namespace, PID 1 only receives signals it has a handler for.
- If the host's init exits, the kernel panics, and if a namespace's init exits, every process in that namespace is killed.