Describe the role and operation of interrupts

Software – Interrupts

What is an interrupt?

An interrupt is a signal that temporarily stops the CPU from executing its current task so it can attend to a higher‑priority event. Think of it as a phone call that pops up while you’re typing a report – you pause, answer the call, then return to typing.

How interrupts work

  1. CPU is executing a program.
  2. An interrupt request (IRQ) is generated by hardware or software.
  3. The CPU pauses the current task and saves its state.
  4. It jumps to the Interrupt Service Routine (ISR) to handle the event.
  5. After the ISR finishes, the CPU restores the saved state and resumes the original task.

Types of interrupts

  • Hardware interrupts – triggered by external devices (e.g., keyboard, mouse, network card).
  • Software interrupts – generated by programs (e.g., system calls).
  • Internal interrupts – caused by CPU errors (e.g., divide‑by‑zero).

Interrupt handling process

Step Action
1 Detect IRQ
2 Save CPU state (program counter, registers)
3 Jump to ISR address
4 Execute ISR (handle event)
5 Restore CPU state
6 Resume original program

Exam Tips

🔹 Define an interrupt and give an example. 🔹 Explain the sequence of steps when an interrupt occurs. 🔹 Differentiate between hardware, software, and internal interrupts. 🔹 Use the ISR acronym and remember the term IRQ. 🔹 When drawing a diagram, label the CPU state save, ISR, and return points clearly.

Revision

Log in to practice.

0 views 0 suggestions