COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY

4.1.4 | INTERRUPTS

Topics from the Cambridge IGCSE (9-1) Computer Science 0984 syllabus 2023 - 2025
OBJECTIVES
4.1.4 Describe the role and operation of interrupts

Including:
  • How an interrupt is generated
  • How it is handled using an interrupt service routine
  • What happens as a result of the interrupts
  • Software interrupts include division by zero and two processes trying to access the same memory location
  • Hardware interrupts include pressing a key on the keyboard and moving the mouse
ALSO IN THIS TOPIC
4.1.1 TYPES OF SOFTWARE AND INTERRUPTS
 4.1.2 TYPES OF SOFTWARE AND INTERRUPTS

4.1.3 TYPES OF SOFTWARE AND INTERRUPTS
 YOU ARE HERE |
 4.1.4 TYPES OF SOFTWARE AND INTERRUPTS
4.2.1 TYPES OF PROGRAMMING LANGUAGES
4.2.2 TYPES OF PROGRAMMING LANGUAGES
4.2.3 - 4.2.4 TYPES OF PROGRAMMING LANGUAGES
4.2.5 TYPES OF PROGRAMMING LANGUAGES
SOFTWARE REVISION CARDS
TOPIC 4 KEY TERMINOLOGY
TOPIC 4 ANSWERS
TOPIC 4 TEACHER RESOURCES
Picture
THE ROLE OF INTERRUPTS
​In computer systems, an interrupt is a signal that prompts the processor to stop executing its current task and to start executing a specific routine, called an interrupt handler. Interrupts allow the operating system to perform tasks that require the processor's attention, even while the processor is executing a program. This allows for efficient multitasking, as the processor can quickly switch between tasks in response to interrupts. For example, an interrupt could be triggered by a keyboard input, a timer, or a network event, allowing the processor to respond to these events in a timely manner.
HOW AN INTERRUPT IS GENERATED
​An interrupt is generated by an interrupt request (IRQ) signal, which is sent by an external device, such as a keyboard, mouse, network card, or timer, to the processor. The IRQ signal is received by the interrupt controller, which informs the processor that an interrupt has been requested. The processor then suspends its current task and starts executing the interrupt handler, which is a routine that performs a specific action in response to the interrupt. The interrupt handler typically retrieves information about the cause of the interrupt and performs the necessary actions, such as reading data from the keyboard or sending data to a network. Once the interrupt handler has completed its task, the processor returns to its previous task, and continues executing the program. This process of interrupt handling is managed by the operating system, which controls the priorities of the interrupts and determines which interrupt handler should be executed in response to an interrupt.
INTERRUPT SERVICE ROUTINE
​An interrupt is handled using an interrupt service routine (ISR), also known as an interrupt handler. An ISR is a program or subroutine that is executed in response to an interrupt request. The ISR performs the necessary actions to process the interrupt and restore the system to its previous state.

The ISR is typically invoked by the operating system's interrupt handler, which is called whenever an interrupt request is received by the processor. The interrupt handler retrieves the source of the interrupt and decides which ISR should be executed.

The ISR then performs the necessary actions, such as reading data from a device, updating data structures, or sending data to a network. Once the ISR has completed its task, it typically sends an end-of-interrupt (EOI) signal to the interrupt controller, indicating that the interrupt has been processed. The processor then returns to its previous task and continues executing the program.

It's important to note that the ISR should be designed to execute as quickly as possible, to minimize the time that the processor is unable to execute other tasks. The ISR should also be designed to be reentrant, meaning that it can be safely invoked multiple times simultaneously, even if a previous invocation of the ISR has not yet completed.
WHAT HAPPENS AS A RESULT OF INTERRUPTS
​As a result of interrupts, the following things happen in a computer system:

Interrupt-driven multitasking: Interrupts allow the processor to perform multiple tasks simultaneously, by quickly switching between tasks in response to interrupts. This makes it possible for the operating system to manage multiple programs or processes and provide a responsive user interface.

Device management: Interrupts are used to manage input/output (I/O) operations, such as reading data from a keyboard or writing data to a disk. The interrupt handler performs the necessary actions to transfer data to and from the device, allowing the processor to continue executing the program while the I/O operations are in progress.

Timing control: Interrupts can be generated by timers, allowing the operating system to keep track of time and manage the scheduling of tasks. For example, an interrupt could be generated every 1/60th of a second to update the screen display in a video game.

Error handling: Interrupts can be used to detect and handle errors, such as hardware failures or invalid user input. The interrupt handler can perform the necessary actions to notify the user of the error, or to recover from the error and restore the system to a stable state.

In summary, interrupts are a crucial aspect of computer systems that allow the processor to manage multiple tasks, devices, and errors, and provide a responsive and stable computing environment.
SOFTWARE INTERRUPTS
​Software interrupts, also known as exceptions, are events that are generated by the processor itself, in response to certain conditions, such as division by zero or access to an illegal memory location. Unlike hardware interrupts, software interrupts are generated by the processor as a result of executing a program, and are handled by the operating system's interrupt handler.

Division by zero: A division by zero interrupt is generated when a program attempts to divide a number by zero, which is undefined in mathematics. The operating system's interrupt handler catches this exception and typically terminates the program, or returns an error message to the user.

Memory access violations: A memory access violation interrupt is generated when two processes attempt to access the same memory location simultaneously. This can cause data corruption or other unpredictable behavior, and is prevented by the operating system's interrupt handler, which assigns exclusive access to the memory location to one of the processes.

In both cases, the operating system's interrupt handler is responsible for detecting and handling the software interrupt, and restoring the system to a stable state. This allows the system to continue executing other programs, even in the presence of errors or conflicts, and provides a stable computing environment for the user.
HARDWARE INTERRUPTS
​Hardware interrupts are events generated by external devices, such as a keyboard, mouse, network card, or timer, that signal the processor to temporarily halt its current task and attend to the interrupt. These interrupts are managed by the interrupt controller, which informs the processor of the interrupt request and decides which interrupt handler should be executed in response to the interrupt.

Keyboard interrupt: A keyboard interrupt is generated when a key on the keyboard is pressed. The interrupt handler reads the key code from the keyboard, and performs the necessary actions, such as updating the screen display or adding the key to a buffer.

Mouse interrupt: A mouse interrupt is generated when the mouse is moved or a button is pressed. The interrupt handler reads the mouse position and button state from the mouse, and performs the necessary actions, such as updating the screen display or changing the cursor position.

In both cases, the interrupt handler performs the necessary actions to manage the input from the device, and the processor returns to its previous task once the interrupt handler has completed its task. This allows the system to process input from the devices in a timely manner, and provides a responsive and interactive computing environment for the user.
Picture
  1. What is an interrupt in computer systems?
  2. What is the difference between hardware and software interrupts?
  3. How does an interrupt controller manage interrupts in a computer system?
  4. What is an interrupt service routine (ISR) and what is its role in handling interrupts?
  5. What happens as a result of an interrupt in a computer system?
  6. What is a division by zero interrupt, and how is it handled by the operating system?
  7. What is a memory access violation interrupt, and how is it handled by the operating system?
  8. What is a keyboard interrupt, and how is it handled by the operating system?
  9. What is a mouse interrupt, and how is it handled by the operating system?
  10. What is the importance of interrupts in computer systems and why are they necessary?
Picture
ALSO IN THIS TOPIC
4.1.1 TYPES OF SOFTWARE AND INTERRUPTS
4.1.2 TYPES OF SOFTWARE AND INTERRUPTS
4.1.3 TYPES OF SOFTWARE AND INTERRUPTS
4.1.4 TYPES OF SOFTWARE AND INTERRUPTS
4.2.1 TYPES OF PROGRAMMING LANGUAGES
4.2.2 TYPES OF PROGRAMMING LANGUAGES
4.2.3 - 4.2.4 TYPES OF PROGRAMMING LANGUAGES
4.2.5 TYPES OF PROGRAMMING LANGUAGES
SOFTWARE REVISION CARDS
TOPIC 4 KEY TERMINOLOGY
TOPIC 4 ANSWERS
TOPIC 4 TEACHER RESOURCES
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.