进程学习-僵尸进程

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
pid_t pid; pid = fork();
if(pid < 0)
printf("error occurred! ");
else if(pid == 0) {
printf("Hi father! I'm a ZOMBIE "); exit(0); //no one waits for this process.
}
else {
sleep(10); wait(NULL); //the zombie process will be reaped now.
}
}

原文地址:https://www.cnblogs.com/qlky/p/6889204.html