Interrupts in practice |
When a device requires the attention of the CPU it will send a interrupt to it. This interrupt will have a specific classification so the CPU can tell the difference and prioritize. It will flag a interrupt in a the interrupt register.
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Flag |
I/O | Timer | Hardware failure | Reset | Power off | HDD | CD | USB | Interrupt |
The register will show which interrupts have occurred. If a timer interrupt has occurred then its flag will be set to 1.
0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | Flag |
I/O | Timer | Hardware failure | Reset | Power off | HDD | CD | USB | Interrupt |
If both the timer interrupt and the HDD interrupt occurs at the same time then the register will be
0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | Flag |
I/O | Timer | Hardware failure | Reset | Power off | HDD | CD | USB | Interrupt |
At the end of the current FDER cycle the OS will decide whether it will process an interrupt or continue with what it is doing. This will depend on the priority of the running process. For example a HDD interrupt will take priority over a timer.