A process can receive two kinds of signals classified based on the source and reason.
- Synchronous are the one that are generated by illegal memory access or division by zero.
- Asynchronous are the one that are generated by another process like SIGKILL and etc.
Quoting from the 9e OSC Book by Prof. Galvin, topic Signal Handling (Section 4.6.2)
A signal may be received either synchronously or asynchronously, depending on the source of and the reason of the event being signaled
...
Examples of synchronous signal incude illegal memory access or and division by zero $0$. ... delivered to the same process that performed the operation that caused the signal.
When signal is generated by an event external to the running process, that process receives the signal asynchronously. Examples of such signal include terminating a process with specific keystrokes (such as CTRL-C) and timer expire (
SIGALRM
from sleep)
In the both cases, the signal must be handled either by custom or default handler. For the synchronous it is crashing the running process, and in asynchronous, it is using the default routine whatsoever is defined in the system.
Here is the list of questions I have in my mind right now:
- What does exactly Synchronous and Asynchronous means here?
- In the synchronous, who is waiting for the receiver process to respond?
- If both of them are need to be handled, then in my opinion, only priority of the execution would be the difference between these two. Does that mean synchronous signals have more priority?
- Can we call synchronous signals as exceptions (or interrupts)? For example we have
ZeroDivisionError
orFileNotFoundError
and all.