

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is an interrupt and how does the processor handle normal and multiple interrupts?
An interrupt is a signal from a device attached to a computer or from a program within the computer that requires the operating system to stop and figure out what to do next.
Whenever an interrupt occurs, it causes the CPU to stop executing the current program. Then comes the control to interrupt the handler or interrupt service routine.
The steps in which ISR handle interrupts are as follows −
Step 1 − When an interrupt occurs let assume processor is executing i'th instruction and program counter will point to the next instruction (i+1)th.
Step 2 − When an interrupt occurs the program value is stored on the process stack and the program counter is loaded with the address of interrupt service routine.
Step 3 − Once the interrupt service routine is completed the address on the process stack is popped and placed back in the program counter.
Step 4 − Now, it executes the resume for (i+1)th line.
Multiple interrupts
Multiple interrupt is an interrupt event which can occur while the processor is handling a previous interrupt.
For example − A program receiving data from a communication line and printing result there is a possibility for communication interrupt to occur while printer interrupt being processed.
Ways to handle interrupts
There are two ways by which processor can handle interrupts
Disable interrupt − Processor will ignore further interrupts while processing one interrupt. Interrupts remain pending and are checked after the first interrupt has been handled. In this process interrupts are handled in sequence
Define priorities − In this method low priority interrupts can be interrupted by higher priority interrupts. Here, high priority interrupt will be handled then processor returns to previous interrupt on which it was earlier working.
Types of interrupts
There are two types of interrupts −
Hardware interrupts − Interrupt signal generated from external devices.
Software interrupts − Interrupt signal generated from internal devices.
We know that the instruction cycle consists of fetch, decode, execute and read/write functions.
After every instruction cycle, the processor will check for interrupts to be processed. If no interrupt is present in the system it will go for the next instruction cycle which is given by the instruction register.
If there is an interrupt present then it will trigger the interrupt handler, the handler will stop the present instruction which is processing and save its configuration in a register and load the program counter of the interrupt from a location which is given by the interrupt table.
After processing the interrupt the processor interrupt handler will load the instruction and its configuration from the saved register, the process will start its processing where it’s left. This is also called context switching.
- Related Questions & Answers
- How does the hardware support interrupt handling in the processor?
- What are interrupts and how interrupt handling is done in modern operating systems?
- What is the difference between VLIW architecture and Superscalar processor?
- What are the interrupt stages and processing?
- What is the difference between context switching and interrupt handling?
- How interrupt is handled by OS and what are the services for user and system?
- What is Superscalar Processor?
- What is RISC Processor?
- What is CISC Processor?
- What Is an Isoquant Curve and How Does It Work?
- What is an SSL certificate and how does it work?
- What is an A-B Trust and how does it work?
- Differentiate between a single processor and a multi-processor.
- What is the Kenney Rule, and how does it work?
- What is the Kelly Criterion and how does it work?