暂停非必要的 CPU 进程
是否可以命令 CPU 暂停所有非必要的进程,直到我的程序完成处理?目标是减少竞争 CPU 处理时间的进程数量,我最终期望程序的挂钟运行时间得到改善。
所以我想开始运行我的程序,命令CPU暂停除我的程序之外的非必要进程,并且当我的程序终止时CPU可以恢复之前暂停的进程。
Is it possible to command the CPU to pause all non-essential processes until my program has finished processing? The goal being to reduce the amount of processes competing for CPU processing time, and I am ultimately expecting an improvement in wall-clock running time of my program.
So I want to start my program running, command the CPU to pause non-essential processes except for my program, and when my program terminates then the CPU can resume the previously paused processes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Linux 上,明显的初始策略是使用 renice 提高进程的优先级。 nice 值越低,优先级越高,最大优先级为-20。
(例如,我创建一个长时间运行的进程)
作为该进程的 root grep ;
将进程调整为非常高的优先级;
您还可以发送 SIGSTOP 和 SIGCONT 信号来停止和继续特定进程,如下所示;
不幸的是,非必要流程的构成取决于您自己的定义。您可以通过检查进程列表来停止所有非 root 进程,并使用以下命令暂时停止所有特定用户的进程;
显然要小心停止进程,例如生成 sudo root 会话的 shell。
On linux, The obvious initial tactic is to increase the priority of your process using renice. The lower the nice value, the higher the priority, with a maximum priority of -20.
(here i create a long running process for example)
as root grep for the process;
renice the process to a very high priority;
You can also send the SIGSTOP and SIGCONT signals to Stop and Continue particular processes like so;
Unfortunately, what constitutes non-essential processes is dependent on your own definition. You can stop all non-root processes by examining the process list, and using the following command to stop all of a particular user's processes temporarily;
Obviously beware of stopping processes such as the shell that spawned your sudo root session.