僵尸进程---子进程已经退出,但是父进程并没有调用wait或waitpid获取子进程的状态信息,那么子进程的进程描述符仍然保存在系统中
int main()
{
/*fork一个子进程*/
pid_t pid = fork();
if (pid > 0)/*父进程*/
{
printf("int parent process,sleep for one miniute...zZ...\n");
sleep(100);
printf("after sleep,and exit !\n");
}
else if (pid == 0)/*子进程*/
{
/*子进程退出,成为一个僵尸进程*/
printf("in child process,and exit !\n");
exit(0);
}
return 0;
}