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 4 days ago 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 4 days ago by Eric Z Ma (42,870 points)
edited 4 days ago 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