Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between SIGSTOP and SIGTSTP?

Just wondering about the difference between SIGSTOP and SIGTSTP signals.

like image 653
user1419715 Avatar asked Sep 26 '22 17:09

user1419715


People also ask

How is SIGTSTP different from SIGSTOP?

The SIGSTOP signal stops the process. It cannot be handled, ignored, or blocked. The SIGTSTP signal is an interactive stop signal. Unlike SIGSTOP , this signal can be handled and ignored.

What is the difference between SIGSTOP and SIGKILL?

The SIGKILL signal is used to abort a process, and the SIGSTOP signal is used to pause a process. The SIGTERM signal is the default signal sent to processes by commands such as kill and pkill when no signal is specified.

How do you use SIGSTOP and SIGCONT?

In short, SIGSTOP tells a process to “hold on” and SIGCONT tells a process to “pick up where you left off”. This can work really well for rsync jobs since you can pause the job, clear up some space on the destination device, and then resume the job.

How use SIGSTOP Linux?

A good method to play with SIGSTOP and SIGCONT is to try the “xeyes” program which is available on most Linux distributions. It shows a couple of eyes that follow your mouse cursor. Once you pause the “xeyes” process you'll notice that the eyes won't follow you anymore…


2 Answers

Both signals are designed to suspend a process which will be eventually resumed with SIGCONT. The main differences between them are:

  • SIGSTOP is a signal sent programmatically (eg: kill -STOP pid ) while SIGTSTP (for signal - terminal stop) may also be sent through the tty driver by a user typing on a keyboard, usually Control-Z.

  • SIGSTOP cannot be ignored. SIGTSTP might be.

like image 195
jlliagre Avatar answered Oct 16 '22 10:10

jlliagre


According with the /usr/include/x86_64-linux-gnu/bits/signum.h file exists the following:

#define SIGSTOP     19  /* Stop, unblockable (POSIX).  */
#define SIGTSTP     20  /* Keyboard stop (POSIX).  */
like image 50
Royce Chao Avatar answered Oct 16 '22 08:10

Royce Chao