How to pause and resume the execution of a process on 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?

asked Aug 11 by anonymous

1 Answer

There are 2 signals related to stopping (pausing) and continuing (resuming) processes:

    Default action is to stop the process. 
    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.

To stop a process with pid ${P}:

kill -STOP ${P}

To continue a process with 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.

answered Aug 12 by Eric Z Ma (43,790 points)
edited Aug 12 by Eric Z Ma

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost