Systems Programming
Daemons
Double-fork technique
- The parent process forks and exits.
- Child process creates a new session via
setsid()
and becomes a new session leader. - In the new session it forks again (grandchildren) to prevent attaching to a terminal. Here is where the daemon itself gets executed.
Additional Resources
Books
- Linux System Programming Techniques by Jack-Benny Persson (2021) (1789951283)