我正在运行一些 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
我不断收到“失效”的进程。这意味着什么?为什么这会发生在我身上?