Process - SIGNAL (KILL, …)


In an OS, the program are entities and they communicate with the Signals principle.

They are considered an (Linux) inter-process communication mechanism.

They are used to signal asynchronous events to one or more processes.

A signal could be generated:

  • by a keyboard interrupt
  • by an error condition.
  • as job control commands to child processes
Type Mean of Communication between
Interrupts the CPU and the OS kernel
Signals the OS kernel and OS processes

Signals may be initiated by:

  • the OS kernel (e.g: SIGFPE, SIGSEGV, SIGIO),
  • or by a process(kill()).

They are eventually managed by the OS kernel, which delivers them to the target thread/process, invoking either:

  • a generic action (ignore, terminate, terminate and dump core)
  • or a process-provided signal handler.

Hardware interrupts can generate signals, like a keyboard interrupt generates SIGINT. Thus interrupts and signals are closely tied to each other.

Number Name Description
11 SIGSEGV segmentation fault
SIGTERM (generated with the kill command
SIGINFO ask for info (generated, for example, by typing the status character, typically control-T, although on some platforms, such as Mac OS X, the status character is not set by default, so you must set it with stty(1) in order to use it)
SIGUSR1 a little bit the same meaning than SIGINFO



kill -l


# Handle shutdowns
function gracefulshutdown {

trap gracefulshutdown SIGINT
trap gracefulshutdown SIGTERM
trap gracefulshutdown SIGKILL


See trap

Example: calling the exit function, the following finish function will run.

function finish {
  # Your cleanup code here
trap finish EXIT

Documentation / Reference

Powered by ComboStrap