Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apache question



On Mon, May 28, 2001 at 11:20:41PM +0900, Viktor Pavlenko wrote:
> >>>>> "JM" == Jake Morrison <jake_morrison@example.com> writes:
> 
>     JM> Jc,
>     JM> Under Unix, a "zombie" has a specific meaning. It's a
>     JM> child process that has exited, and the system is holding its
>     JM> return status around, but there is no parent process 
>     JM> left around that cares to read it. They still show up 
>     JM> on the ps display, but there is nothing there. So they 
>     JM> are the "living dead". 
> 
>     JM> In your case, it sounds like the processes are hung, waiting
>     JM> for something to happen, or they are just working slowly. 
>     JM> Sometimes this happens when all the processes are waiting
>     JM> on a single resource, like an overloaded disk or network 
>     JM> connection.
> 
> I should have read my email before posting, sorry...
> 
> But the last question remains: init has just to fetch the zombie's
> exit status, what takes it so long?

This was the way it worked on sunos.

parent forks child
child exits
parent does a wait
all is well

parent forks child
parent exits
init calls wait on parent
init becomes parent of child
child exits
init calls wait
all is well

parent forks child
child exits
parent exits (doesn't call wait)
since child is already dead, init can't become the parent and wait on it.
child becomes a zombie.
init can wait on the parent though.

a zombie, just takes up an entry in the process table with the status
of its exit. All other memory has been freed.

Actually, I don't think linux suffers from zombies like sunos. If the
parent doesn't call wait then init will, according to man ps and the
program below. On sunos, it was there until the next reboot. So I would
guess that the parent is hanging around somewhere and just hasn't got
round to calling wait yet.

Try this for example...

#include <unistd.h>
main()
{
	int pid = fork();

	if(pid == 0) /* child */
		exit(1);
	else         /* parent */
		sleep(2);

	/* child is zombie, lets exit without wait. */
	exit(2);
}


Tom.
-- 
Thomas O'Dowd. - Nooping - http://nooper.com
tom@example.com - Testing - http://nooper.co.jp/labs


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links