【问题标题】:What happens when first child process exits, then parent exits without calling wait?当第一个子进程退出,然后父进程没有调用等待就退出时会发生什么?
【发布时间】:2019-01-05 00:51:18
【问题描述】:

fork 调用后,child 调用 exit(),然后 parent 正常退出。孩子是否成为孤儿并成为父母?如果是这种情况,我不应该在 init 调用 wait 之前将进程视为僵尸吗?

【问题讨论】:

    标签: unix process operating-system fork


    【解决方案1】:

    它被init 重新定义(采用)。是的,在init 调用wait() 之前,你会看到一个僵尸进程——但init 直接调用wait(),所以在实践中你永远不会捕捉到僵尸进程。 init 非常擅长立即收获重新设置为它的僵尸进程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-07
      • 1970-01-01
      • 2011-07-05
      相关资源
      最近更新 更多