A process may send a signal to another process. a process can register its own signal processor for signal processing. SIGKILL and SIGSTOP are two signals that cannot be captured.
When a process executes a signal handler, it blocks the same signal. This means that when the signal handler is in progress, if another one of the same signals arrives, it will not call the signal handler [called signal blocking], but it makes a note that the signal has reached [ie: waiting signal]. after the handler of an already working signal is executed, the waiting signal is processed. If you do not want to trigger a waiting signal, you can IGNORE the signal.
The problem with the above concept is this:
Suppose the following: process A has a registered signal handler for SIGUSR1.
1) process A gets signal SIGUSR1, and executes signalhandler() 2) process A gets SIGUSR1, 3) process A gets SIGUSR1, 4) process A gets SIGUSR1,
When step (2) is performed, it is done as a โpending signalโ. Those.; it needs to be serviced. And when step (3) occurs, it is simply ignored, since there is only one bit available to indicate the waiting signal for each available signal.
To avoid such a problem, for example: if we do not want to lose signals, then we can use real-time signals.
2) Signals are executed synchronously,
Eg.
1) process is executing in the middle of signal handler for SIGUSR1, 2) Now, it gets another signal SIGUSR2, 3) It stops the SIGUSR1, and continues with SIGUSR2, and once it is done with SIGUSR2, then it continues with SIGUSR1.
3) IMHO, that I remember about checking for the presence of any signal in the process:
1) When context switch happens.
Hope this helps to some extent.