The best uses I’ve found for the SIGSTOP and SIGCONT signals are times when a process goes haywire, or when a script spawns too many processes at once.
Usage Examples for both signals:
1 2 | kill -SIGSTOP [pid] kill -SIGCONT [pid] |
Wikipedias great definition for SIGSTOP:
When SIGSTOP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell, among other purposes. SIGSTOP cannot be caught or ignored.
And for SIGCONT:
When SIGSTOP or SIGTSTP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell, among other purposes.
In short, SIGSTOP tells a process PID to “hold on” and SIGCONT tells a process to “pick up where you left off”.
This work very well if one process needs a lot of memory and you need this memory now – you can pause a process and continue it.
Leave a Reply