Sai Raman Kilambi
Sai Raman Kilambi

Reputation: 888

Difference between a Daemon process and an orphan process?

I am confused with daemon process and orphan process. From what I have learnt:

Daemon Process: "These are special processes that run in background. They are system related process that have no associated terminal.These processes run with root permissions and usually provide services to processes.Usually parent process will terminates and hence child process will become a daemon process as it wont have any terminal.For daemon process, init process will become a parent process"

Orphan Process: "when parent process gets killed before child process terminates, then that process becomes an orphan process. In that case the child processes become orphan and then taken under by the init process."

Is an orphan process a daemon process and vice versa? If not, what is the basic difference between them?

Upvotes: 7

Views: 2867

Answers (2)

Stephane Desmarais
Stephane Desmarais

Reputation: 386

I agree with answer from Defrag. I would just like to mention that a daemon does not necessarily run as root. In fact, for security reasons, it is preferable not to run some daemons as root, for example a web server process, or an Database listener process. This limits your exposure if the daemon has a security issue.

Also, users themselves could write programs that run as daemon.

Upvotes: 0

Defrag
Defrag

Reputation: 416

One doesn't strictly imply the other: just think of daemons as intentionally orphaned processes. They are intended to work without a parent, but this doesn't apply to every orphaned process!

It is sometimes desirable to intentionally orphan a process, usually to allow a long-running job to complete without further user attention, or to start an indefinitely running service or agent; such processes (without an associated session) are known as daemons, particularly if they are indefinitely running

Just think of daemons as "slaves" who does the dirt job: you intentionally put them out of your sight, but not everything that goes out of your sight is intended or specifically wanted ;)

I think Wikipedia, in this case, is good enough to satisfy your dilemma: https://en.wikipedia.org/wiki/Orphan_process

Upvotes: 6

Related Questions