Skip to content

Signals

Category: Communication · Status: stub · Lessons: chapter 08, Processes (planned)

One line: Asynchronous notifications the operating system delivers to a process — an interrupt from the keyboard, a closed pipe, a child that exited — and which, in a threaded program, one thread has to be chosen to receive.

Also called: Unix signals, SIGINT, SIGPIPE, signal handler.

How it connects

flowchart LR
  n_ipc["Inter-process communication"]
  n_signals["Signals"]
  n_signals -->|is a| n_ipc
  classDef center stroke-width:3px
  class n_signals center
  classDef outside stroke-dasharray: 4 3
  class n_ipc outside

In each language

Go os/signal delivers signals as values on a channel
C sigaction installs a handler; pthread_sigmask chooses which threads may receive one
Python signal: handlers always run in the main thread of the main interpreter

Where to read more