If a process is needed to capture a signal and handle it accordingly, it is necessary to register the signal processing function (in fact, the kernel needs to identify the signal function, similar to the C language include a function library).
Processing the signal is like a soft interrupt, the kernel prepares a signal vector table for each process and records the processing mechanism of the signal. When a signal occurs, the kernel invokes the registered function to process it.
When the signal comes, it is unknown, so the process cannot wait for the signal to come. The reception of the signal does not have a user process to complete, requires the kernel to proxy. When the user process P2 sends a signal to another process P1, the kernel receives the signal and places the signal in the signal queue of the P1 process. When the P1 process enters the kernel state, the signal queue is checked and the corresponding signal function is transferred for processing.
Linux signal Interpretation (3)--Signal processing mechanism