Recently, wrote a pcap aspect of the program, when the program started, there is a daemon monitoring, will restart;
The program itself will be multi-threaded monitoring of all active network cards, while using two threads, one to do time-out check, a connection status display;
Today in the replacement, found that there is a zombie process this situation occurs, because the internal use of a lot of sleep, maybe you kill the main thread, the child thread is still dormant, causing this phenomenon;
Now describe how to kill the zombie process to replace the program;
1, first replace the execution program, with MV, can not use CP,CP will prompt said: cp:cannot create regular file './dev_list_server ': Text file Busy
2, determining the zombie process related information: PS-E-O stat,ppid,pid,cmd | Egrep ' ^[zz] '
3, you may need to use this command: PS-EF | grep "Defunct"
4, kill all the displayed sub-processes;
5, so that when the daemon restarts, it will start and you have replaced the execution program.
Online said that my situation is ideal, described as follows:
By ending the parent process to end the zombie process, this can only be considered an ideal situation, many times the zombie process we can not end the parent process, such as the parent process is the INIT process, the end of the parent process, the entire system is dead, this time can consider the hanging screwdriver process, which is equivalent to "curve salvation." Once a process is suspended, it is tantamount to "doing nothing". You can suspend a process by executing the following command.
Kill-hup process PID to the specified ID process, send suspend condition;
Describes the record end.
Kill the Zombie process