Signals are a simple UNIX mechanism for controlling processes. A signal is a 5-bit message to a process that requires immediate attention. Each signal has associated with it a default action; for some signals, you can change this default action. Signals are generated by exceptions, which include:
Attempts to use illegal instructions
Certain kinds of mathematical operations
Window resize events
The user pressing an interrupt key on a terminal
Another program using the kill() l or killpg() system calls
A program running in the background attempting to read from or write to its controlling terminal
A child process calling exit or terminating abnormally
The system default may be to ignore the signal, to terminate the process receiving the signal (and, optionally, generate a core file), or to suspend the process until it receives a continuation signal. Some signals can be caught - that is, a program can specify a particular function that should be run when the signal is received. By design, UNIX supports exactly 31 signals. They are listed in the files /usr/include/signal.h and /usr/include/sys/signal.h. Table 27.4 contains a summary.
Hangup (sent to a process when a modem or network connection is lost)
Interrupt (generated by CTRL-C (Berkeley UNIX) or RUBOUT (System V).
I/O trap instruction; used on PDP-11 UNIX
Emulator trap instruction; used on some computers without floating-point hardware support
Bus error (invalid memory reference, such as an attempt to read a full word on a half-word boundary)
Segmentation violation (invalid memory reference, such as an attempt to read outside a process's memory map)
Bad argument to a system call
Write on a pipe that has no process to read it
Software termination signal (default kill signal)
Urgent condition present
Stop signal generated by keyboard
Continue after stop
Child process state has changed
Read attempted from control terminal while process is in background
Write attempted to control terminal while process is in background
CPU time limit exceeded
File size limit exceeded
Virtual time alarm
Profiling timer alarm
tty window has changed size
User-defined signal #1
User-defined signal #2
 The signal number varies on some systems.
 The default action for most signals is to terminate.
If signal is not caught or ignored, generates a core image dump.
Signal is ignored by default.
Signal causes process to suspend.
Signal cannot be caught or ignored.
Signals are normally used between processes for process control. They are also used within a process to indicate exceptional conditions that should be handled immediately (for example, floating-point overflows).