// A C program to demonstrate Zombie Process. // Child becomes Zombie as parent is sleeping // when child process exits. #include #include #include #include int main() { // Fork returns process id // in parent process pid_t child_pid = fork(); // Parent process if (child_pid > 0) { printf("\n In the parent process. Waiting for 10 seconds.\n "); fflush(stdout); sleep(10); printf("\n Parent process has exited.\n "); fflush(stdout); } // Child process else { printf("\n In the child process. Waiting for 60 seconds. \n"); fflush(stdout); sleep(60); printf("\n Child process exiting.\n"); fflush(stdout); } return 0; }