linux暂停进程
How to pause the execution of a process on Linux so that the CPU can be freed? Later, if the node is idle again, how to resume the execution?
如何暂停Linux上进程的执行,以便可以释放CPU? 稍后,如果节点再次处于空闲状态,如何恢复执行?
There are 2 signals related to stopping (pausing) and continuing (resuming) processes:
有两个与停止(暂停)和继续(恢复)过程有关的信号 :
Stop
Default action is to stop the process.
Cont
Default action is to continue the process
if it is currently stopped.
You may use kill
to pause and resume a process in Linux by sending these signals to it.
您可以通过向Linux发送这些信号,使用kill
来暂停和恢复Linux中的进程。
To stop a process with pid ${P}
:
要使用pid ${P}
停止进程:
kill -STOP ${P}
To continue a process with pid ${P}
:
要使用pid ${P}
继续执行过程:
kill -CONT ${P}
Note: be very careful to pass the correct signals to kill
. If no signal is specified to kill
, the TERM signal is sent. The TERM signal will kill the process if it does not catch the signal.
注意:要非常小心地传递正确的信号来kill
。 如果没有信号被指定为kill
,术语发送信号。 如果TERM信号没有捕获到该信号,它将终止该过程。
翻译自: https://www.systutorials.com/how-to-pause-and-resume-the-execution-of-a-process-on-linux/
linux暂停进程