暂停进程? [英] Pausing a process?

查看:58
本文介绍了暂停进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法暂停进程(从可执行文件运行),以便它在暂停时停止 cpu 负载,并等到它未暂停继续工作?可能在 python 中,或者以某种方式通过 python 访问.

解决方案

通过使用 psutil ( https://github.com/giampaolo/psutil ):

<预><代码>>>>导入 psutil>>>somepid = 1023>>>p = psutil.Process(somepid)>>>p.暂停()>>>假设()

Is there a way to pause a process (running from an executable) so that it stops the cpu load while it's paused, and waits till it's unpaused to go on with its work? Possibly in python, or in some way accessible by python.

解决方案

By using psutil ( https://github.com/giampaolo/psutil ):

>>> import psutil
>>> somepid = 1023
>>> p = psutil.Process(somepid)
>>> p.suspend()
>>> p.resume()

这篇关于暂停进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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