A signal reports the occurrence of an exceptional event. These are some of the events that can cause (or generate, or raise) a signal:
A program error such as dividing by zero or issuing an address outside the valid range.
A user request to interrupt or terminate the program. Most environments are set up to let a user suspend the program by typing C-z, or terminate it with C-c. Whatever key sequence is used, the operating system sends the proper signal to interrupt the process.
The termination of a child process.
Expiration of a timer or alarm.
A call to kill
or raise
by the same process.
A call to kill
from another process. Signals are a limited but useful form of interprocess communication.
An attempt to perform an I/O operation that cannot be done. Examples are reading from a pipe that has no writer (see Pipes and FIFOs), and reading or writing to a terminal in certain situations (see Job Control).
Each of these kinds of events (excepting explicit calls to kill
and raise
) generates its own particular kind of signal. The various kinds of signals are listed and described in detail in Standard Signals.