In Linux, processes can send signals that are used to interrupt, announce asynchronous events to a process.

Common signals include:

  • SIGINT is a signal generated when a user presses Control-C. This will terminate the program from the terminal.
  • SIGALRM is generated when the timer set by the alarm function goes off.
  • SIGABRT is generated when a process executes the abort function.
  • SIGSTOP tells LINUX to pause a process to be resumed later.
  • SIGCONT tells LINUX to resume the processed paused earlier.
  • SIGSEGV is sent to a process when it has a segmentation fault.
  • SIGKILL is sent to a process to cause it to terminate at once.

What happens when a signal occurs?

A process may choose to do one of three things…

  • Ignore it: many can be ignored but Hardware signals like “divide by zero cannot be ignored successfully and some signals such as SIGKILL cannot be ignored at all.
  • Catch and handle the exception: The process has some function to execute, but now it may terminate the program and handle the exception OR handle without terminating.
  • Default Action: Every signal has some default action associated with it. These include:
    • ignore- terminate
    • terminate and dump core
    • stop or pause the program
    • resume a program paused earlier