Abstract
- A Process (进程) that runs in the background
- Most important Process (进程) with Process IDentifier (PID) 1
- Manages the lifecycle of all services that run in the background
- Below shows a list of common init systems. Basically Systemd for Linux Kernel, Launchd for MacOS and busybox for for Embedded OS like OpenWRT
Something simpler
If you just want to run a task in the background after the user logs out, you can just run
nohup <command> &
, the standard output and standard error streams are redirected to a file namednohup.out
in the current directory by default. But this doesn’t restart the service on failure or after a reboot etc.
Orphan Process
- A Child Process becomes an orphan if its parent process terminates before it completes, and it is typically adopted by the Init System which immediately calls wait() on the child process to prevent it from becoming a zombie
Important
If an orphan process exits and its adopted parent hasn’t reaped it yet, it can simultaneously be both an orphan and a zombie.