LearnViz CompSci
Home / Learn / Computer Architecture & Logic / Interrupts

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

  1. The CPU runs normal code.
  2. A device raises an interrupt signal.
  3. The CPU saves its state and jumps to the handler.
  4. The handler serves the device quickly.
  5. 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

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Interrupts?
Signals diverting the CPU to handle urgent events. It belongs to Computer Architecture & Logic and is an advanced-level topic.
Where do people use Interrupts?
Handling input without polling, timer ticks for scheduling, completing disk and network transfers, system calls and error handling all rely on interrupts.
What is the most common mistake with Interrupts?
Handlers must be short and avoid blocking, since they run with other interrupts possibly disabled.
What should I learn before this topic?
Start with DMA, the topic just before it in Computer Architecture & Logic.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Computer Architecture & Logic quiz.
Is Interrupts hard to learn?
It is an Advanced topic. Expect to read the explanation more than once and to connect it with earlier topics. Working through a small example by hand helps most.
How long does it take to learn Interrupts?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Interrupts?
DMA, Bus Architecture, GPU Architecture are closely connected. The full list is in the related topics section of this page.
What should I study after Interrupts?
Continue with Bus Architecture, the next topic in Computer Architecture & Logic.

Related topics