DronaBlog

Monday, November 19, 2018

What are Zombie, Orphan and Daemon processes in Unix system?

Are you looking for the information about process management in Unix System? If already know about foreground and background process and would like to know more about Zombie, Orphan and Daemon processes in Unix system? If yes, then refer this article to understand more interesting things about process management in Unix. If you have not gone through the previous article about Process Management in Unix System then I would recommend going through it first.

What are Zombie processes?

Zombie processes are those processes which are killed or completed execution but still shows an entry in the process table.

Important points-
  • The zombie process shows the process with a Z state.
  • The zombie process is also known as the defunct process.
  • Such kind of processes are dead and not being used for any business or system processing.
  • The orphan processes and the zombie processes are different.
  • A child process always first becomes a zombie before being removed 
  • To remove zombies we can use 'kill' command as the SIGCHLD signal can be sent to the parent manually.
Reasons for the zombie processes-
  1. The issue in the parent program: If the Zombies that exist for more time then it indicates an issue in the parent program
  2. The issue with child program: The Unix system uncommon decision to not reap children.
  3. The operating system issue: The bug in the operating system may cause the parent program is no longer running.

Impact of the zombie process-
  1. No out of memory issue as the zombie process does not consume memory
  2. The issue with running out of process table entries

 What are Orphan processes?

A child process which remains running itself even after its parent process is completed or terminated is called as an orphan process.

Important points

  1. The orphan process is get created unknowingly and unintentionally due to process crash.
  2. Normally, Unix system tries to protect the orphan process with help of user's shell. The Unix system tries to terminate the child processes by SIGHUP process signal.
  3. Re-parenting automatically happens in Unix environment. i.e. assigning the parent to the child process. However, it is internal to Unix system
  4. An orphan process is a computer process whose parent process has finished or terminated, though it remains running itself. Normally special init system process will be the parent for such orphan process. The process is still considered an orphan process as its original parent who created this process is no more exists.
  5. In some cases, the orphan process is created intentionally. This is to detach the current user's session and let it run in the background, especially when the process is long running. Sometimes such orphan processes are also called a daemon process.

What is the daemon process?

The system related processes which run in the background and often run with the permissions of the root are called daemon processes. In many cases, these daemon processes service requests from other processes.
  1. A daemon has no controlling terminal. 
  2. The daemon process cannot open /dev/tty. 
  3. e.g If we execute the command "ps -ef" and all daemon processes will have ? for the tty field in the output.
  4. If we have a program which runs for a long time, it is good idea to make it a daemon and run it in the background.
  5. Normally, such processes start when the system is bootstrapped 
  6. The daemon processes terminate only when the system is shut down. 

Example of daemon process is real world is - printer daemon waiting for print commands.



No comments:

Post a Comment

Please do not enter any spam link in the comment box.

What is Dynamic Data Masking?

                        Are you looking for details about Dynamic Data Masking? Are you also interested in knowing what are the things we ne...