  signals are a limited form of inter-process communication used in unix, unix-like, and other posix-compliant operating systems. a signal is an asynchronous notification sent to a process or to a specific thread within the same process in order to notify it of an event that occurred. signals have been around since the 1970s bell labs unix and have been more recently specified in the posix standard. when a signal is sent, the operating system interrupts the target process's normal flow of execution to deliver the signal. execution can be interrupted during any non-atomic instruction. if the process has previously registered a signal handler, that routine is executed. otherwise, the default signal handler is executed. embedded programs may find signals useful for interprocess communications, as the computational and memory footprint for signals is small. == sending signals == the kill(2) system call will send a specified signal to a specified process, if permissions allow. similarly, the kill(1) command allows a user to send signals to processes. the raise(3) library function sends the specified signal to the current process. exceptions such as division by zero or a segmentation violation will generate signals (here, sigfpe and sigsegv respectively, which both by default cause a core dump and a program exit). the kernel can generate signals to notify processes of events. for example, sigpipe will be generated when a process writes to a pipe which has been closed by the reader; by default, this causes the process to terminate, which is convenient when constructing shell pipelines. typing certain key combinations at the controlling terminal of a running process causes the system to send it certain signals: * ctrl-c (in older unixes, del) sends an int signal (sigint); by default, this causes the process to terminate. * ctrl-z sends a tstp signal (sigtstp); by default, this causes the process to suspend execution. * ctrl-\ sends a quit signal (sigquit); by default, this causes the process to terminate and dump core. * ctrl-t (not supported on all unixes) sends an info signal (siginfo); by default, and if supported by the command, this causes the operating system to show information about the running command. these default key combinations with modern operating systems can be changed with the stty command. == handling signals == signal handlers can be installed with the signal() system call. if a signal handler is not installed for a particular signal, the default handler is used. otherwise the
Control_flow Unix_signals