/* This is the way to make a zombie. 
 * See them with ps auxww | grep defunct (or grep zombie).
 * Signal handler with SIGCHLD and wait() can clean them up.
 */
#include <stdio.h>
#include <unistd.h>

int main() {
  int i;

  for (i=0; i<5; i++) {

    if (fork()== 0) { /* child */
      printf("%d will be <defunct> (zombie)\n", getpid());
      exit(0);
    }

    sleep(5);
  }

  printf("parent is exiting so will clean up zombies.\n");

}

