Linux Processes


Though you had studied about processes in your RHCE Training and RHCSS Training.

Many times students ask what is a daemon process and how it is different from other processes of Linux.

So here goes a small explanation about the type of process in Linux.

1. Daemon Process – Its very simple, actually the easiest to understand. Daemon, in ancient Greek belief is – A divinity or supernatural being of a nature between gods and humans. Simply put it is there, but not there. You can see it. It doesn’t occupy physical space. 

OK, lets come on the technical stuff. As per wikipedia its a program that run as a background process and is not attached to a physical terminal. They are system related process. These processes run will root permissions.

As I told you that these processes are not attached to a terminal.

Then the question is that – How they are created? 

To create a Daemon process, it has to be detached from a terminal. The best way to do is to run a process through terminal and from within this process create another process and then terminate the parent process. Since the parent is terminated so now the child will become independent of the terminal and would be taken over by init process and hence would become a daemon process. Some very common examples of daemon processes are servers like sshd, httpd, smtpd, smdb etc. They all provide you services but are never attached to any specific terminal yet running, you cannot see them, but feel them .. like ghosts or daemon.

2. Child Process – Again quoting wikipedia. A child process in computing is a process created by another process (the parent process). A child process inherits most of its attributes, such as file descriptors, from its parent.

So a child process is created by some other process during run-time. Usually child processes are created to execute some binary from within an existing process. Child processes are created using fork() system call. Normally process are made to run through shell/terminal. In that case the shell becomes the parent and the executed process becomes the child process.

PS: On Unix/Linux each process has a parent except the init process

3. Orphan Process – As the name suggest, the process whose parent had died or terminated but the child process is still running. Very Simple 

GEEKS!! normally, when the child process terminates, a signal is issued to the parent so that parent can do all the stuff that it is required to do when one of the child gets terminated. But there are situations when parent gets killed. In that case the child processes become orphan and then taken under by the init process. Though the init process takes the ownership of the orphan process but still these process are called as orphan as their original parents no longer exists.

4. Zombie Process – Referring wikipedia again. A zombie process or defunct process is a process that has completed execution but still has an entry in the process table.

Simply. When a child process gets terminated or completes its execution, then its entry in the process table remains until the parent process fetches the status information of the terminated child. So, until then the terminated process enters zombie state and is known as zombie process. Its like someone had died but the authorities hadn’t issued the “death certificate” yet, so during the time since someone was dead and the time his “death certificate” is issued – he is in zombie state.

PS: Don’t panic.

Please refer the illustration for reference.

Linux Processes Explained

Linux Processes Explained