2.1.5

Interrupts

Test yourself

Interrupts

Interrupts are an essential part of modern computer systems that tell the CPU when something needs attention.

Illustrative background for InterruptsIllustrative background for Interrupts ?? "content

Interrupts

  • An interrupt is a signal from a piece of software or hardware that tells the CPU that it needs some attention.
  • Interrupts are an efficient way of telling a computer when a job needs to be completed.
Illustrative background for Hardware interruptsIllustrative background for Hardware interrupts ?? "content

Hardware interrupts

  • Hardware interrupts can occur when an input or output operation completes.
  • Hardware interrupts can also involve errors, like when a printer runs out of paper.
Illustrative background for Software interruptsIllustrative background for Software interrupts ?? "content

Software interrupts

  • Software interrupts come from pieces of software that need to terminate or request services from the OS to complete a task.
  • For example, opening a document.
Illustrative background for Alternatives to interruptsIllustrative background for Alternatives to interrupts ?? "content

Alternatives to interrupts

  • One alternative to using interrupts is polling.
  • Polling is when the CPU polls (asks) every piece of software and hardware if it needs anything doing.
  • This would be a very inefficient process.

Interrupt Service Routine (ISR)

An interrupt service routine is a set of instructions that need to be done as part of an interrupt.

Illustrative background for ISRIllustrative background for ISR ?? "content

ISR

  • An interrupt service routine is a set of instructions that need to be done as part of an interrupt.
  • When an interrupt service routine has been completed, the CPU will go back to the set of instructions it was doing before.
Illustrative background for ProcessIllustrative background for Process ?? "content

Process

  • As an interrupt arrives at the CPU it comes with a flag to indicate the priority of the interrupt.
  • This interrupt could be higher importance than the set of instructions it is currently working.
  • The interrupt pushes the current instruction and all the contents of the registers in the CPU to a stack.
Illustrative background for Process cont.Illustrative background for Process cont. ?? "content

Process cont.

  • The CPU will then complete the interrupt service routine and then load the registers back in from the stack and continue where it left off.
  • At the end of each fetch, decode, execute cycle, the CPU checks for interrupts and their priorities before continuing on.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Procedurally

6.3Thinking Logically

7Problem Solving & Programming

8Algorithms

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson