How do I avoid creating zombies? Zombies are child processes that have exited but because the parent process has not handled the SIGCHLD signal (by calling wait(), for example) the process remains in the proc table and uses a proc slot. Zombie processes are the processes that show up as defunct from "ps" output. To avoid creating zombie processes in C code set the flag SA_NOCLDWAIT in the sa_flags field of the sigaction struct then call sigaction on SIGCHLD. The following is a code sample that does this. #include #include ... int main(int argc, char *argv[]) { struct sigaction sa; ... /* prevent zombies */ sa.sa_handler = SIG_IGN; sa.sa_flags = SA_NOCLDWAIT; if (sigaction(SIGCHLD, &sa, NULL) == -1) { perror("sigaction"); exit(1); } .... For more information see sigaction(2), wait(2), fork(2), signal(2), or signal(5).