The wait system calls reaps the zombied childs of a process. wait() blocks so you may want to look at waitpid() instead. Read the manpages for better explanations.