Zombie Process is the son of the process due to the introduction of the service did not use the process of collecting wait-function state of the process of arising. Zombie is a process, the process has come to an end, do not take up the memory system resources, CPU time for little or no impact, but the process will take place in the table. As the process of table space is limited, Linux systems have a number of the process is limited, too many zombie process will affect the process of the new generation.
Zombie process exists to give programmers and system administrators to provide some important information in the process. This information, including how the end of the process, in the course of operation as to whether there was an error, and so on. If there is no zombie process, which will end with the process of disappearing. As a result, the process of carrying the corpse of information for programmers and systems administrators found that the procedure has a problem of great significance.
I wrote a simple zpro.c output of the process of zombie code sample:
# include <stdlib.h>
# include <sys/types.h>
# include <unistd.h>
int main (void)
{
pid_t pid;
pid = fork();
if(pid<0){
perror(”Cannot create new process”);
exit(1);
}
if (pid>0)
sleep (60);
else
exit(0);
return 0;
}
Gcc compiler to use the above procedure zpro.c, a zpro executable file. In the background of the implementation of procedures and the use of ps command to view information related to the process. Can see the zpro process in the process of the list of state for the zombie process.
[netspy@localhost ~]$ gcc -c zpro zpro.c
[netspy@localhost ~]$ ./zpro &
[1] 6031
[netspy@localhost ~]$ ps -e -o pid,ppid,stat,cmd |grep zpro
6031 3729 S ./p7.18
6032 6031 Z [zpro] <defunct>
6037 3729 S+ grep zpro
[netspy@localhost ~]$
To understand the causes of the zombie process, it is easy to clear the process of zombies. In the Linux system, each process is the father of the existence of the process. If the Father of the process of being switched off, the son of the process will become orphans by the process of taking over the process of init. If the child process for the zombie, then the process, init process will be responsible for the clean-up. In other words, turn off the corpse as long as the process of the father of the process, it is clear zombie process.