Signal Handling

Signal Handling in Operating Systems

Types of Signals

One Shot Signals
  • Definition: One shot signals are a category of signals characterized by their unique handling properties.

  • Handling Guarantee:

    • When multiple instances of the same one shot signal occur, the signal handler will be executed at least once.

    • This means that if only one instance of the signal occurs, the handler executes once.

    • Conversely, if multiple occurrences happen, only one execution of the handler is guaranteed, leading to potential loss of some signal occurrences.

  • Re-enabling Requirement:

    • The handling routine for one shot signals must be re-enabled after each execution.

    • Custom Signal Handlers:

    • When a process installs a custom signal handler for a particular one shot signal, this handler will be invoked only once upon the signal’s occurrence.

    • For any subsequent instances of that one shot signal, the process will either revert to the default operating system action or, if the OS ignores such signals, those signals will be lost.

Real Time Signals
  • Definition: Real time signals are another type of signal, with behavior that allows for more robust signal handling, provided in operating systems like Linux.

  • Queuing Behavior:

    • When a real time signal is raised N times, the corresponding handler is assured to be called N times.

    • This characteristic differentiates real time signals from one shot signals, as they exhibit queuing behavior rather than overriding behavior.

  • Implications:

    • The queuing nature allows for better management of signals in environments where multiple signal occurrences need to be accounted for, providing reliability in the execution of the signal handler.