Advanced Topic 42 of 51 Computer Architecture & Logic
Interrupts
Signals diverting the CPU to handle urgent events.
How it works
An interrupt is a signal that makes the processor suspend the current program, save its state and run a handler, then resume. Hardware interrupts come from devices such as timers, keyboards and network cards, software interrupts come from instructions like system calls, and exceptions come from faults such as division by zero or page faults. An interrupt vector table maps each source to its handler, and a controller prioritizes and masks them.
Step-by-step walkthrough
- The CPU runs normal code.
- A device raises an interrupt signal.
- The CPU saves its state and jumps to the handler.
- The handler serves the device quickly.
- The CPU restores its state and resumes the program.
Where it is used
Handling input without polling, timer ticks for scheduling, completing disk and network transfers, system calls and error handling all rely on interrupts.
Common pitfall
Handlers must be short and avoid blocking, since they run with other interrupts possibly disabled. Shared data between a handler and normal code needs protection from races. Missing the acknowledgement of a device leaves the interrupt firing forever, and interrupt storms can freeze a system.
Where it fits in the course
Interrupts is topic 42 of 51 in Computer Architecture & Logic, rated Advanced. It follows DMA. The next topic is Bus Architecture.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Computer Architecture & Logic quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Interrupts?
Where do people use Interrupts?
What is the most common mistake with Interrupts?
What should I learn before this topic?
How can I practice it?
Is Interrupts hard to learn?
How long does it take to learn Interrupts?
Which topics are related to Interrupts?
What should I study after Interrupts?
Related topics
- DMA (Computer Architecture & Logic)
- Bus Architecture (Computer Architecture & Logic)
- GPU Architecture (Computer Architecture & Logic)
- Storage Devices (Computer Architecture & Logic)
- Interrupts in Embedded Systems (Mobile, Embedded & IoT)