Zombie vs Orphan vs Daemon Processes

Details about the zombie, orphan and daemon processes are given as follows −

Zombie Processes

A zombie process is a process whose execution is completed but it still has an entry in the process table. Zombie processes usually occur for child processes, as the parent process still needs to read its child’s exit status. Once this is done using the wait system call, the zombie process is eliminated from the process table. This is known as reaping the zombie process.

A diagram that demonstrates the creation and termination of a zombie process is given as follows −

Zombie Process in Linux

Zombie processes don't use any system resources but they do retain their process ID. If there are a lot of zombie processes, then all the available process ID’s are monopolized by them. This prevents other processes from running as there are no process ID’s available.

Orphan Processes

Orphan processes are those processes that are still running even though their parent process has terminated or finished. A process can be orphaned intentionally or unintentionally.

An intentionally orphaned process runs in the background without any manual support. This is usually done to start an indefinitely running service or to complete a long-running job without user attention.

An unintentionally orphaned process is created when its parent process crashes or terminates. Unintentional orphan processes can be avoided using the process group mechanism.

Daemon Process

A daemon process is a background process that is not under the direct control of the user. This process is usually started when the system is bootstrapped and it terminated with the system shut down.

Usually the parent process of the daemon process is the init process. This is because the init process usually adopts the daemon process after the parent process forks the daemon process and terminates.

The daemon process names normally end with a d. Some of the examples of daemon processes in Unix are −

  • crond

    This is a job scheduler that runs jobs in the background.

  • syslogd

    This is the system logger that implements the system logging facility and collects system messages.

  • httpd

    This is the web server daemon process that handles the Hypertext Transfer Protocol.

  • dhcpd

    This daemon configures the TCP/IP information for users dynamically.