in reply to zombies after forking
Zombies are formed when a child dies but the parent is still active. At any stage, the parent may ask for the return status of the child, hence it can't be removed completely: you have these zombies hanging around just in case. So, they are completely normal, and don't take up resources, etc. They are removed when the parent exits, since they are no longer needed.
The only way you can get rid of them is to prove to the system they are no longer needed: i.e., the parent must be dead already. Daemons do this by forking twice and having the first child quit immediately, which 'detaches' the second child from the original parent. However, you fork a number of times over a period of time, so this probably won't gain you anything in terms of reduced numbers of zombies.
|
|---|