Zombie process

I am looking into how to create zombie process. They are created when parent process don't call wait() and hence they are not removed from the process table. How do I create zombie process in C++? What part of the code when missed, make a process/thread zombie? Is it the pthread_join()?

Thanks.
while(true) fork();
Konstantin2s code will really work - but you may run in trouble :-)

A process stays in zombie state if not caught by its parent using wait() or one of its corresponding system calls and if the parent doesn't terminate. If parent terminates then the init-process will catch the zombie. In most systems it's called init having process id 1.
Last edited on
Topic archived. No new replies allowed.