Chinaunix首页 | 论坛 | 博客
  • 博客访问: 325554
  • 博文数量: 106
  • 博客积分: 3081
  • 博客等级: 中校
  • 技术积分: 1090
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-15 14:07
文章分类

全部博文(106)

文章存档

2009年(1)

2007年(34)

2006年(71)

我的朋友

分类: C/C++

2006-03-15 16:26:33

 

#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) |
给主人留下些什么吧!~~