Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 509
Sai Raman Kilambi Avatar asked Feb 03 '17 01:02

Sai Raman Kilambi


1 Answers

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

like image 104
Defrag Avatar answered Sep 18 '22 12:09

Defrag