0

I have read that daemon processes in Linux a result of double forking. Are all the daemon process a result of double forking or are there some exceptions?

1 Answer 1

1

"Daemon" is not a special process state; it's a descriptive term. Any process which runs completely unattached to a terminal or any other user interface (i.e. in background), but provides services in some other way, can be called a daemon.

Double-forking is often used as the mechanism for a process to detach itself from a terminal and go into background (as well as clearing the "parent process ID" information). It is necessary if, for example, you start a service by directly running sudo ftpd or apachectl start in a terminal.

However, it is not necessary when the process is started already in the correct state. Most "service managers" such as systemd or Upstart are designed in such a way that neither the manager itself nor the service processes are ever attached to a terminal or "foreground" in any way. Whenever you systemctl start a service, it runs as a daemon from the very beginning, making double-forking redundant.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .