What are the behavioral differences between a daemon and a normal process?

后端 未结 3 1008
天涯浪人
天涯浪人 2021-02-01 06:39

I know that daemons run in the background mostly i.e. they require very less interaction from the user.

Wikipedia lists some of the types of daemons that commonly exist:

相关标签:
3条回答
  • 2021-02-01 06:54

    The key difference between a Process and a Daemon is that a Daemon's parent is init - the first process started during *Nix booting. And that is why a Daemon is not connected to a terminal. So when you close your terminal it will not be killed by OS. But still you can send signals to your Daemon.

    0 讨论(0)
  • 2021-02-01 07:04

    Not really. A daemon is just a term for a process that runs continuously and usually is not attached to a terminal.

    Daemons are not a separate class of processes and they have no special privileges or attributes.

    There is a BSD/Linux C function called daemon (man page), but this is just really a simple way to detach your process from its terminal. It is so named because that's what daemons usually do, not the other way around.

    0 讨论(0)
  • 2021-02-01 07:10

    The question is a little vague, but I'll try anyways:

    Technically, daemons are just processes like any other. They usually, but are not required to, have misc file descriptors closed and other behavior suited for processes that live a long time. For a high level look at how most daemon processes are set up (in Python), check out: http://www.noah.org/wiki/Daemonize_Python

    So the differences really come down to lifecycle and users. Daemon processes live for long periods of time, usually as long as a given runlevel. They also usually provide services to other system-wide processes, or processes higher up than the average user run process..

    0 讨论(0)
提交回复
热议问题