#include
#include
#include
int main(void)
{
pid_t pid;
if((pid=fork())<0)
{
printf("fuction fork error\n");
exit(-1);
}
else if(pid==0)
{
printf("now exit");
_exit(0);
}
else {while(1){printf("parent process");};}
return(0);
}
/*when the child process have alreay closed before parent process,kernel will
release its memeory and close its close and open file. but this process remain
leave some information for kernel to save.so the parent of this process will
check this process is close or not.this imformation is : process ID, process
close character, CUP time of process.now we call these already closed but the
parent have not check its close status process --僵尸process
$ps
PID TTY STAT TIME COMMAND
2558 p0 R 0.02 demo7
2559 p0 Z 0:00 (demo7 )
*/
阅读(728) | 评论(0) | 转发(0) |