Перейти к содержанию

Labs · 9618 AS 4.1 · A2 16.1

Прерывания

Be the CPU. Devices send interrupts while a program runs. Check the interrupt register after every cycle, compare priorities, save the PC on the stack and run the right ISR.

5 levelsFree bench

In the exam

9618/11 May/June 2023 · Question 6 · 5 marks

A key is pressed on a keyboard, and this generates an interrupt. Explain how the computer handles the interrupt.

Points that gain marks

  • An interrupt flag is set in the interrupt register.
  • The register is checked at the end of the current fetch–execute cycle (or the start of the next one).
  • The CPU checks whether the interrupt has a higher priority than the current process.
  • If it does, the contents of the registers are saved on the stack.
  • The interrupt service routine (ISR) for the key press is called, and the key's data is processed.
  • The registers are restored from the stack, and control goes back to the process that was interrupted.

In this lab: Each step is a button here: the bit in the interrupt register, the check at the end of every cycle, the priority comparison, the PC pushed on the stack, the ISR's start address in the PC, and the pop that brings the old PC back.

More real experiments

Войти или создать аккаунт

IGCSE, A-Level & AP