As the name suggests,these interrrupts are set by hardware
components or peripheral devices like hard disks.
Disk controller using the bus to signal that a disk request has
been fulfilled.What actually happens is that disk Raises an
interrupt.The disk interrupt handler then copies the retrieved data
into memory for the later use by the program that made the
request.When an event occurs the micro-controller generates a
hardware interrupt. The interrupt forces the
micro-controller's program counter to jump to a specific address in
program memory. This special memory address is called the
interrupt vector. At this memory location we install a
special function known as an interrupt service routine
(ISR) which is also known as an interrupt handler. So upon
generating a hardware interrupt, program execution jumps to the
interrupt handler and executes the code in that handler.
we describe interrupt handling in a scenario where the hardware
does support identifying the device that initiated the interrupt.
In such cases, the exact source of the interrupt can be identified
at hardware level.
- A device asserts the interrupt signal
at a hardwired interrupt level.
- The processor registers the interrupt
and waits to finish the current instruction execution.
- Once the current instruction execution
is completed, the processor initiates the interrupt handling by
saving the current register contents on the stack.
- The processor then switches to
supervisor mode and initiates an interrupt acknowledge cycle.
- The interrupting device responds to
the interrupt acknowledge cycle with the vector number for the
interrupt.
- Processor uses the vector number
obtained above and fetches the vector.
- The address found at the vector is the
address of the interrupt service routine (ISR) for the interrupting
device.
- After the ISR routine has performed
its job, the ISR executes the "return from interrupt"
instruction.
- Execution of the "return from
interrupt" instruction results in restoring the processor state.
The processor is restored back to user mode.
-
we describe interrupt handling in a scenario where the hardware
does not support identifying the device that initiated the
interrupt. In such cases, the possible interrupting devices need to
be polled in software.
- A device asserts the interrupt signal
at a hardwired interrupt level.
- The processor registers the interrupt
and waits to finish the current instruction execution.
- Once the current instruction execution
is completed, the processor initiates the interrupt handling by
saving the current register contents on the stack.
- The processor then switches to
supervisor mode and initiates an interrupt acknowledge cycle.
- No device responds to the interrupt
acknowledge cycle, so the processor fetches the vector
corresponding to the interrupt level.
- The address found at the vector is the
address of the interrupt service routine (ISR).
- The ISR polls all the devices to find
the device that caused the interrupt. This is accomplished by
checking the interrupt status registers on the devices that could
have triggered the interrupt.
- Once the device is located, control is
transferred to the handler specific to the interrupting
device.
- After the device specific ISR routine
has performed its job, the ISR executes the "return from interrupt"
instruction.
- Execution of the "return from
interrupt" instruction results in restoring the processor state.
The processor is restored back to user mode
- While the disk is
reading or writing data, the CPU can go execute
instructions.
-
lMore complex than exceptions
lRequires registry, deferred processing, etc.
lThree types of actions:
lCritical: Top-half (interrupts disabled – briefly!)
lExample: acknowledge interrupt
lNon-critical: Top-half (interrupts enabled)
lExample: read key scan code, add to buffer
lNon-critical deferrable: Do it “later” (interrupts enabled)
lExample: copy keyboard buffer to terminal handler process
lSoftirqs, tasklets.