Two types of interrupts exist in the Linux operating system: hardware interrupts and software interrupts. Software interrupts are called signals or traps. Software interrupts are used for inter-process synchronizations.
Signals are used to notify us about a certain event occurrence or to initiate a certain activity.
We use software signals many times. For example, if any command does not respond after being 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 Ctrl + C. 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...