Operating System Design/Processes/Signals

From Wikibooks, open books for an open world
Jump to: navigation, search

Signals are commonly used in POSIX systems. Signals are sent to the current process telling it what it needs to do, such as, shutdown, or that it has committed an exception. A process has several signal-handlers which execute code when a relevant signal is encountered. The ANSI header for these tasks is <signal.h>, which includes routines to allow signals to be raised and read.

Signals are essentially software interrupts. It is possible for a process to ignore most signals, but some cannot be blocked. Some of the common signals are Segmentation Violation (reading or writing memory that does not belong to this process), Illegal Instruction (trying to execute something that is not a proper instruction to the CPU), Halt (stop processing for the moment), Continue (used after a Halt), Terminate (clean up and quit), and Kill (quit now without cleaning up).