Difference between a Daemon process and an orphan process?
Asked Answered
C

2

7

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?

Calcutta answered 3/2, 2017 at 1:57 Comment(0)
W
6

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

Wondawonder answered 3/2, 2017 at 2:6 Comment(0)
J
0

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.

Jurisprudent answered 3/6, 2019 at 14:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.