使用并行程序包删除僵尸进程 [英] Remove zombie processes using parallel package

查看:94
本文介绍了使用并行程序包删除僵尸进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在基于Debian的机器上使用R的并行程序包玩了一段时间后,我仍然找不到在计算后删除所有僵尸子进程的方法.

After I have played around for some time using R's parallel package on my Debian-based machine I still can't find a way to remove all zombie child-processes after a computation.

我正在寻找一种通用且与操作系统无关的解决方案.

I'm searching for a general and OS independent solution.

下面的简单脚本说明了2个内核的问题:

Below a simple script illustrating the problem for 2 cores:

library(parallel)
testfun <- function(){TRUE}

cltype <- ifelse(.Platform$OS.type != "windows", "FORK", "PSOCK")
cl <- makeCluster(2, type = cltype)
p <- clusterCall(cl, testfun)
stopCluster(cl)

不幸的是,该脚本在进程表中留下了两个僵尸进程,只有在R关闭时它们才会被杀死.

Unfortunately, this script leaves two zombie processes in the process table which only get killed if R is shut down.

推荐答案

这似乎只是"FORK"群集的问题.如果改用"PSOCK"群集,则调用stopCluster(cl)时,进程将死亡.

This only seems to be an issue with "FORK" clusters. If you make a "PSOCK" cluster instead, the processes will die when you call stopCluster(cl).

有什么阻止您在基于Debian的计算机上使用"PSOCK"集群的方法?

Is there anything preventing you from using a "PSOCK" cluster on your Debian-based machine?

这篇关于使用并行程序包删除僵尸进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆