Two types of interrupts exist in the Linux operating system: the hardware interrupt and the software interrupt. Software interrupts are called signals or traps. Software interrupts are used for interprocess synchronizations.
Signals are used to notify about a certain event occurrence or to initiate a certain activity.
We use software signals many times, for example, if any command is not responding after it is typed, then you might have entered Ctrl + C. This sends a SIGINT
signal to the process, and the process is terminated. In certain situations, we may want the program to perform a certain activity instead of terminating it using the Ctrl + C command. In such cases, we can use the trap
command to ignore a signal or to associate our desired function with that signal.
In operating systems, software interrupts or signals are generated when the process attempts to divide a number by zero or due to power failure, system hang up, illegal instruction execution,...