// COMPLETE THREAD

I am looking for a way to create a zombie process

3 expanded posts ยท every known parent and child

NODE e6aab878I am looking for a way to create a zombie process
I am writing a paper that, among other things, talks about detecting
zombie processes.  I find that, due to my systematic hunting down and
eliminating of these processes, I no longer have any hanging around for
demonstration purposes.  How embarassing - I don't know how to create
one!

Is there anyone who can give me a simple program or set of commands that
creates a zombie process? Thanks in advance. 

-- 
-> See: Info-Sec Heaven at URL http://all.net
Management Analytics - 216-686-0090 - PO Box 1480, Hudson, OH 44236
NODE a0c93d12Re: I am looking for a way to create a zombie process
> Is there anyone who can give me a simple program or set of commands that
> creates a zombie process? Thanks in advance. 

Here, public domain.

#include <stdio.h>
#include <unistd.h>

int
main()
{
    if (!fork()) {
	/* Child; die. */
	exit(0);
    } else {
	/* Child dies, is zombie for ten seconds. */
	sleep(10);
	/* Reap it. */
	wait();
	/* Now no zombie. */
	sleep(10);
	exit(0);
    }
}
-- 
Shields.
NODE c1e58414Re: I am looking for a way to create a zombie process
In article <m0t4X3e-000DgnC@yage.tembel.org>,
Michael Shields <shields@tembel.org> wrote:
>> Is there anyone who can give me a simple program or set of commands that
>> creates a zombie process? Thanks in advance. 
>
>Here, public domain.
>
<snip>
>	wait();
<snip>

wait(NULL); would be saner.

   - Ian