Hardware and Interrupts
- Basic overview of hardware
- CPU connected to a system bus with a memory controller and
several I/O
controllers.
- Devices also connected to CPU via interrupt lines.
- CPU and device talk via shared memory
- Devices can request the CPU's attention via an interrupt
- CPU can request the device's attention via writing to a special
part of
'memory'.
- Other models are possible.
- Interrupts
- Definition -- async hardware event causing change in CPU flow
of control.
- Types
- Processor exception
- Error (division by zero, illegal instruction)
- Normal (VM page missing, emulated instructions)
- Software (some CPUs use for system calls)
- synonym for TRAP
- Generated by a device
- I/O completion (not normally I/O start)
- Clock timer. (Time of day, scheduling)
- Attributes
- Possibly Maskable
- Maximum latency allowed
- Possibly Shared
- Interrupt handling
- Interrupt table in RAM
- Save enough info to be able to restart
- put on stack (yours or a fixed stack or system stack)
- Normally interrupt code must save registers
- Modern RISC is to make interrupt spill hard to understand
- Exec interrupt routine
- Maybe some service is required (process uses an interrupt to
make a system call, instruction emulation?)
- Maybe handled a problem (access to non-existant memory
address, divide by zero, illegal instruction)
- Maybe device wanted attention (IO is finished, timer went off)
- Resume execution
- Interrupt Priority
- Often interrupts DISABLE other interrupts
- this function built into hardware to avoid race condition
- Disabled interrupts are often MISSED but sometimes
DELAYED/QUEUED
- Sometimes interrupts disabled for O.S. needs
- changing important system table, SMP needs, etc.
- Can screw I/O if disabled for two long.
- Some interrupts cannot be disabled (NMI, clock, page fault).