linux – 限制允许进程树使用的CPU百分比?
发布时间:2020-12-14 00:31:30 所属栏目:Linux 来源:网络整理
导读:我可以限制正在运行的进程的CPU百分比以及它当前和未来的所有子进程可以使用的组合吗?我听说过cpulimit工具,但这似乎忽略了子进程. 编辑:所以,the answer我发现需要cpulimit不断运行,直到我们希望限制保持有效,因为它通过主动发送暂停然后继续向进程发送信
我可以限制正在运行的进程的CPU百分比以及它当前和未来的所有子进程可以使用的组合吗?我听说过cpulimit工具,但这似乎忽略了子进程.
编辑:所以,the answer我发现需要cpulimit不断运行,直到我们希望限制保持有效,因为它通过主动发送暂停然后继续向进程发送信号来进行限制.是否有其他方法可以实现这种限制效果,也许不需要在后台运行这样的辅助过程? 解决方法
是!
就像我写这个问题一样,发现我正在尝试使用旧版本的cpulimit. new version也支持限制子进程. $cpulimit -h Usage: cpulimit [OPTIONS...] TARGET OPTIONS -l,--limit=N percentage of cpu allowed from 0 to 400 (required) -v,--verbose show control statistics -z,--lazy exit if there is no target process,or if it dies -i,--include-children limit also the children processes -h,--help display this help and exit TARGET must be exactly one of these: -p,--pid=N pid of the process (implies -z) -e,--exe=FILE name of the executable program file or path name COMMAND [ARGS] run this command and limit it (implies -z) Report bugs to <marlonx80@hotmail.com>. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |