/* * Author: evuraan * * when the child has exited, and the parent has not * yet collected the child's death certificate, * the child process becomes a zombie * */ #include char *cmd[300]; int main(){ int pid; pid = vfork(); if (pid == 0){ /* child */ exit(0); } else { /* parent */ printf("Parent at pid: %d and ppid: %d\n", getpid(), getppid() ); printf("Our child %d will be the zombie, watch below:\n", pid); sprintf(&cmd, "%s %d", "ps -o state,pid,command -p ", pid); sleep(1); system(cmd); } return 0; }