operating-systems

Definition

Interrupt

An interrupt is an asynchronous signal sent to the processor by hardware or software indicating an event requiring immediate attention. Unlike traps, interrupts are caused by events external to the running process.

Mechanism

Interrupt Handling Sequence

  1. Hardware: CPU completes current instruction, saves PC and PSW to system stack, loads new PC from interrupt vector
  2. Context Save: OS saves registers, sets up handler stack
  3. Service Routine: Interrupt service routine (ISR) executes
  4. Scheduling: OS decides next process (may trigger process switch)
  5. Context Restore: OS restores registers, resumes selected process

Sources

Timer Interrupts

Used by the OS for timeouts and preemptive multitasking.

I/O Interrupts

Signals from devices (keyboard, network, disk) indicating operation completion or data availability.

Hardware Failures

Power loss, memory parity errors, or other critical hardware events.