Once in a while you will see some strange processes with
<defunct> instead of a process name. This happens when a child process terminates, but the parent process isnīt interested in the outcome because it didnīt waited for the childs response. Almost all resources of the child process are freed up at the moment with the exception of the entry in the process table. The parent process need it to get the exit code from itīs child, thus you canīt simply delete it on the termination of the child. The remaining process table entry will be delete, when the parent proccess reaps the child process by gathering the exit code. But when the parent forgets to reap the child, itīs undead, itīs defunct. Or to stay in the terminology: Youīve produced a Zombie process.
Letīs create such a process. Itīs really easy, we just have to create a long running process forking away a child but we donīt use the
wait() system call to gather itīs response at the exit.
bash-3.2$ nohup perl -e "if (fork()>0) {while (1) {sleep 100*100;};};"&
Okay, letīs check for our processes. In the output of
ps -ecl the zombie processes are marked with a
Z:
bash-3.2$ ps -ecl |grep "Z"
F S UID PID PPID CLS PRI ADDR SZ WCHAN TTY TIME CMD
0 Z 100 27841 27840 - 0 - 0 - ? 0:00 <defunct>
bash-3.2$
A
kill -9 to this process is without effect. Obviously, a zombie will go away when you terminate the parent process, but that isnīt alway an option. How can you get rid of this Zombies? Okay, with Solaris you can reap such processes manually. The
preap forces the parent to reap the child by calling
wait() system call on the child.
bash-3.2$ preap 27841
27841: exited with status 0
And when you look in the process table again you will see, that the zombie founds itīs peace...
bash-3.2$ ps -ecl |grep "Z"
F S UID PID PPID CLS PRI ADDR SZ WCHAN TTY TIME CMD
Obviously, you should ask yourself, why an application leaves such zombie processes, when the task of reaping them away manually gets a frequent task. Often itīs because of bad programming style.
Comments
Sun, 07.09.2008 16:42
Hmm ... ich habe damit gerechn et, seit dem Muentefering in d ie Politik zurueck gekehrt ist ... und die Entwicklung [...]
Sun, 07.09.2008 15:53
Leihst Du mir bei Gelegenheit mal Deine Glaskugel...
Sun, 07.09.2008 13:28
Hmmm ... wasnīt sure about tha t ... i think i will go to my prefered Apple technican after talking with that compa [...]
Sun, 07.09.2008 13:04
Aber ist weniger schlecht unbe dingt besser?
Sun, 07.09.2008 13:01
The Macbooks have clear plasti c in front of the camera modul e, so there actually is no hol e. It's not exceptionall [...]