【问题标题】:How to intepret <defunct> c++ process ubuntu如何解释 <defunct> c++ 进程 ubuntu
【发布时间】:2013-09-13 12:50:43
【问题描述】:

我正在运行一些 C++ 代码(在 8 个内核的 Ubuntu 上运行的 8 个独立进程)。

我正在使用 python 启动 C 进程:

def runC():
    numThreads = multiprocessing.cpu_count()
    threads = []
    for i in range(numThreads):
        args = ("./cprogram", arg1,arg2,arg3)
        popen = subprocess.Popen(args, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        threads.append(popen)

    for t in threads:
       t.wait()
       output = t.stdout.read()
       err = t.stderr.read()
       if len(output) > 0:
          print "output: " + output
       if len(err) > 0:
          print "err: " + err

我不断收到“失效”的进程。这意味着什么?为什么这会发生在我身上?

【问题讨论】:

  • 这太模糊了,甚至不知道您在说什么,更不用说回答任何问题了。能不能给个更详细的说明。
  • 感谢@PaulEvans ;) 我已经详细说明了。

标签: c++ ubuntu defunct


【解决方案1】:

原来是 t.wait() 导致了僵尸进程。根据作业完成的顺序,在 t.wait() 处理它们之前,会有一些处于僵尸状态。这不是一个真正的问题,这是我想确定的。

【讨论】:

    猜你喜欢
    • 2018-01-17
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-11
    • 2019-08-03
    • 2019-12-23
    • 2010-10-25
    相关资源
    最近更新 更多