Software

Software

Firmware and interrupts

Types of Software and Interrupts Paper 1 9 min read

On this page
  1. In this note
  2. What you should already know
  3. Hardware, firmware, OS, applications
  4. Interrupts
  5. Summary
  6. Ways they test it
  7. What the examiner looks for
  8. Past-paper questions, solved
  9. Common mistakes
  10. Practice
  11. Can I do this?
  12. Quiz

In this note

Syllabus 4.1 Types of software and interrupts
  • 4.1.3Understand how hardware, firmware and an operating system are required to run applications software.
  • 4.1.4Describe the role and operation of interrupts: how one is generated, how it is handled using an interrupt service routine, and what happens as a result.

Before this: System and application software. Next: Programming languages and translators.

Part 1Learn the topic

The notes: every idea from the start, with our own examples.

What you should already know

ROM

ROM is non-volatile, read-only primary storage. It keeps its contents with the power off.

Quick check: what does ROM store?

The start-up instructions: the BIOS / bootstrap (firmware).

The FDE cycle

The CPU fetches, decodes and executes one instruction at a time.

Quick check: when can the CPU check for interrupts?

At the end of each fetch-decode-execute cycle.

Hardware, firmware, OS, applications

Firmware is software permanently stored in ROM that controls the hardware. The most important firmware is the bootloader (also called the bootstrap / BIOS): the instructions that start up the computer and load the operating system.

Applicationsrun on the operating systemOperating systemruns on the firmwareFirmware (bootloader / BIOS)runs on the hardwareHardwareCPU, RAM, storage, devicesloadedlastfirst
Each layer runs on the one below it.

General methodWhat happens when you switch on

  1. The hardware powers up and the CPU runs the bootloader, which is firmware stored in ROM.
  2. The bootloader loads the operating system from secondary storage into RAM: the OS runs on the firmware.
  3. The OS gives a platform for the applications, which run on the operating system.

Interrupts

An interrupt is a signal sent to the CPU to show that something needs its attention. Interrupts let the computer react straight away to events (a key press, a printer running out of paper) instead of checking every device all the time. They are managed by the operating system (its interrupt handler).

Hardware interrupts (from a device)Software interrupts (from a program)
pressing a key on the keyboard; moving the mouse or clicking a button; plugging in a device; printer out of paper / ink; paper jamdivision by zero; two processes trying to access the same memory location; a program asking for input / output; a null value error

General methodHow an interrupt is handled

  1. A device or program generates an interrupt (e.g. a key is pressed) and it is sent to the CPU.
  2. The interrupt is given a priority and placed in the interrupt queue.
  3. The CPU finishes its current fetch-decode-execute cycle, then checks the interrupt queue.
  4. If the interrupt has a higher priority than the current task, the CPU saves the current task (the contents of its registers) and calls the interrupt service routine (ISR) for that interrupt.
  5. The ISR handles the interrupt (e.g. reads the key, shows the "out of paper" message).
  6. The CPU checks the queue again; when there are no more higher-priority interrupts it restores the saved task and carries on.
  7. If the interrupt has a lower priority, the CPU simply continues the current task and the interrupt waits in the queue.
Interrupt service routine (ISR) (also called the interrupt handler): the sequence of instructions that handles one particular interrupt.

Example A printer runs out of paper

Describe what happens.

  1. The printer sends an interrupt to the CPU.
  2. The interrupt is given a priority and placed in the interrupt queue.
  3. The CPU finishes its current FDE cycle and checks the queue: the paper interrupt has a higher priority.
  4. The CPU saves its current task and calls the ISR for the printer.
  5. The ISR displays a message telling the user to add paper; the CPU then restores the saved task.

Answer Result: the user sees "Out of paper" straight away, and the program they were using carries on.

Try it yourself

1
Where is the bootloader stored?
Show answer

Answer In ROM (it is firmware)

2
Is division by zero a hardware or software interrupt?
Show answer

Answer Software

3
What is the name of the program that services an interrupt?
Show answer

Answer Interrupt service routine (ISR) / interrupt handler

Summary

  • Applications run on the OS; the OS runs on the firmware; the bootloader (firmware, in ROM) runs on the hardware.
  • Interrupt: a signal to the CPU that something needs attention; managed by the OS.
  • Hardware interrupts: key press, mouse, printer. Software: division by zero, two processes same memory.
  • Handling: priority → queue → CPU finishes FDE cycle → checks queue → saves task → ISR → restores task.

If you see …

  • "explain how the processor manages the current program and the interrupt" [5]priority · queue · finish FDE cycle · check queue · store task · ISR · restore
  • "state the purpose of an interrupt"to indicate something needs the attention of the CPU
Part 2How it is examined

Question types, what the examiner gives marks for, and real past-paper questions solved.

Ways they test it

Type 1 Layers cloze

"… software is run on the operating system. The … system is run on the firmware, which is run on the …" [4]

Spot it a word list.

  1. Applications → OS → firmware → hardware.

Type 2 Firmware

"State the purpose of firmware" [1]; "give one example" [1]

Spot it "firmware".

  1. Purpose: permanently stores instructions to start the computer / control the hardware. Example: bootloader, BIOS.

Type 3 Examples

"Give two examples of a hardware / software interrupt" [2]

Spot it "examples".

  1. Use the table.

Type 4 Handling

"Describe how interrupts are used when a key is pressed" [5]; the printer paragraph [7]

Spot it "describe how".

  1. Follow the handling method in order, naming the device from the question.

What the examiner looks for

"Describe how interrupts are used when a key is pressed on a keyboard" [5]

Marking points (one mark each, up to the marks shown)

  • Key press generates the interrupt
  • Interrupt is given a priority
  • Interrupt is sent to the CPU … and placed in a queue
  • CPU stops its current task (at the end of the FDE cycle) to check the queue / service the interrupt …
  • … using an interrupt service routine
  • If the key press is the highest priority the interrupt is processed

Keywords priority queue interrupt service routine

Past-paper questions, solved

0478/11/M/J/23 Q4Paper 1 · Computer systems4 marksFull size
Complete the statements about types of software

How to start Use the layer diagram: who runs on whom?

Show a full-mark answer and the mark scheme

System software provides the services that the computer requires … Application software is run on the operating system. The operating system is run on the firmware, which is run on the hardware.

PartAnswer / workingMarksGuidance
4System · Application · Operating · HardwareB4
Total: 4 marks
0478/13/M/J/24 Q9Paper 1 · Computer systems9 marksFull size
Printer interrupt paragraph; OS functions that relate to memory

How to start (a) follow the handling method. (b) which OS functions are about memory?

Show a full-mark answer and the mark scheme

(a) printer · computer · priority level · fetch-decode-execute cycle · interrupt queue · higher · interrupt service routine (ISR)

(b) Managing memory; managing multitasking.

PartAnswer / workingMarksGuidance
9(a)printer · computer · priority level · FDE cycle · interrupt queue · higher · ISRB7
9(b)memory management · multitaskingB2
Total: 9 marks
0478/11/O/N/23 Q9Paper 1 · Computer systems10 marksFull size
Interrupts: managing software, a key press, and examples

How to start (b) is the handling method for a key press. (c) two of each kind.

Show a full-mark answer and the mark scheme

(a) The operating system.

(b) Pressing the key generates an interrupt, which is sent to the CPU. It is given a priority and placed in the interrupt queue. The CPU finishes its current FDE cycle and checks the queue. If the key press has the highest priority, the CPU saves its current task and services the interrupt using an interrupt service routine.

(c)(i) Moving the mouse; a printer running out of paper. (ii) Division by zero; two processes accessing the same memory location.

PartAnswer / workingMarksGuidance
9(a)Operating system // interrupt handlerB1
9(b)Any five: key press generates · priority · sent to CPU · queue · CPU stops current task / checks queue · ISR · highest priority processedB5
9(c)(i)Any two: moving / clicking the mouse · plugging in a device · paper jam · out of paperB2
9(c)(ii)Any two: division by zero · two processes same memory location · null valueB2
Total: 10 marks

Common mistakes

  • ✗ "The CPU stops immediately"✓ "The CPU finishes its current FDE cycle first"
  • ✗ "The interrupt is always handled straight away"✓ "Only if it has a higher priority than the current task"
  • ✗ "Firmware is stored in RAM"✓ "Firmware is permanently stored in ROM"
  • ✗ "Typing a letter" as a software interrupt✓ A key press is a hardware interrupt

Practice

Practice: easy, medium, hard

Easy

1
Which software runs directly on the hardware?
Show answer

Answer Firmware (the bootloader)

2
Give one example of a hardware interrupt.
Show answer

Answer e.g. a key press

Medium

1
State the purpose of an interrupt.
Show answer

Answer To indicate that something needs the attention of the CPU

2
Explain why the CPU saves its current task before servicing an interrupt.
Show answer

Answer So it can restore it and carry on from the same point afterwards

Hard

1
A program divides a number by zero while a user is moving the mouse. Explain how the CPU decides which interrupt to service first. [2]
Show answer

Answer Each interrupt is given a priority and placed in a queue; the CPU services the highest priority one first

Can I do this?

Anything unticked: revise that section first. All ticked: take the quiz.

Quiz

The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.

Your progress on this note is saved when JavaScript is on.

⬇️ Download this chapter as a PDF: Full notes