×

COA: Interrupt and its types

Introduction: In general terms, the word interrupt means to stop the progress of ongoing work in between or to break the continuation of the work. In early digital computing, the system processor has to wait a long for the signal to process. Internally CPU has to check every hardware and software program to get any signal from them to process, and this method of checking signal in the system is known as Polling method.

The disadvantage is that the system wastes several clock cycles in searching the signal in the system. If any signal came for the process, the processor would take time to execute the process as it was busy in the polling process, which degrades the system's performance and response time.

So, to improve or overcome this problem, a new mechanism was introduced by an engineer in which instead of searching the signal from hardware and software, the processor will receive a signal from them to execute the process for completing the instruction. This mechanism of sending a signal by hardware and software for a process called interrupting the system.

Definition: Transfer of program control from a currently running program to hardware and software-generated signal request for the processor, which creates a disturbance to a running program. This disturbance is called an Interrupt.

Interrupts are the snatching of processor/control from a currently running program, giving it to the third party program to execute the instruction, and then transferring the control to the previous program. This situation arises due to some error conditions, user requirements, software and hardware requirement. The CPU handles all the interrupts very carefully, and priority is given to all the interrupts to execute every instruction.

COA: Interrupt and its types

In the above diagram, Assume it is a memory having one program with many instructions ( I1, I2, I3……In). Program is a set of instructions, and one by one instructions are executing. Suppose, during the execution of instruction I, an interrupt occurs. A request is generated externally or internally to process the program first (interrupt generated program).

Generally, the processor's control came to the i+1 instruction, but due to the interrupt, it moves to the interrupt instruction; after the interrupt instruction's execution, the control return from the interrupt to the next instruction (i+1). Control returns to the original program after the service program is executed.

But before the interrupt occurs, the CPU was processing an instruction. So before moving to interrupt execution, the CPU completes the instruction (i) and saves the instruction state because it has to return to the address after completing the instruction. The CPU saves the following information before giving control to the interrupt instruction.

(i) Value of program counter (PC)

        PC => i+1

(ii) Value of all the CPU registers

Before moving to i+1 instruction, all the values of instruction (I) in registers were saved.

(iii) Content of status bit conditions.

All the status bit conditions are stored in the program status word (PSW). Commonly there are four used flags, Status bit, Carry bit, Overflow bit, Zero bit, which are saved in the stack part of memory.

Note: All these values and conditions are saved in the stack part of memory. CPU does not respond to an interrupt until the execution of currently running instruction ends.

How does the CPU execute interrupt instruction?

So, before going to the next fetch cycle and after completion of the first instruction cycle (I), the CPU checks for an interrupt signal; if there is an interrupt, then it does the following steps:

  • Save the previously executed program state in the CPU called as CPU state includes value of program counter, CPU Registers, program state word in the memory stack.
  • When the CPU starts execution of interrupt instruction, it saves the following state.

     Program Counter (PC) ß interrupt branch address.

     Program Status Word (PSW) ß Status bits of the interrupt service program.

  • Last instruction of service program, when control returns from interrupt.
  • All the old values which are stored in the stack are taken back to fetch the new instruction. Value of PSWß old PSW, PSß PC, CPU register ß old CPU memory.

Interrupt and its types | Computer Organization and Architecture

Different types of program interrupt are:-

  1. Hardware interrupt
  2. Software interrupt
COA: Interrupt and its types
  1. Hardware interrupt

Interrupt generated by the hardware of the computer system is called hardware interrupts. For example: In the continuation of a running program, if we press any key from the keyboard, then a signal is generated to the processor, which is called an interrupt and is first executed by the system.

Hardware interrupts are classified into two categories.

External and Internal interrupts – Both are initiated from the signal that occurs in the CPU hardware.

External interrupt - These interrupts are generated by hardware internally. These are asynchronous (does not depend on anything) and predictable interrupts. Example of external interrupts are:-

  • Timings of input/output devices when they request for data transfer.
  • Power failure due to circuit monitoring the power supply or any external source creates an interrupt.
  • A program that goes into an endless loop generates a timeout interrupt.
  • When the input/output device finished the transfer of data.

Internal interrupt – These interrupts are generated when there is an "error in instruction” happens. This type of interrupts results from illegal and erroneous use of instruction, widely known as “Traps”. Internal interrupts are “synchronous”( depend on the timer clock) with the program. These are unpredictable interrupts.

Reasons for internal interrupts are:-

  • It happens due to register overflow error occur.
  • When divide by zero, errors occur.
  • Due to an invalid operation code ( Opcode).

2. Software interrupts

It is a special type of instruction that behaves like an interrupt created by the user rather than a subroutine call. It is an error generating program created by the user whenever the user wants to create, widely known as a software interrupt. It is initiated by executing an instruction or an interrupt procedure at any desired point of the program.

For example, Some error instructions are generated to check the proper functioning of the program.

Supervisor call instruction generates a software interrupt to switch from user mode to supervisor mode.

There are two cases of occurrence of software interrupts.

  1. Normal interrupt- When an interrupt created by instruction or user made an error program intentionally are normal software interrupts.
  2. Exceptional interrupt- An exception case of interrupt or unplanned instruction generated in a program like a number is generated during the execution of an instruction divisible by zero will give undefined value and creates an interrupt.

Related Topics

Micro-Operations

Micro-Operations If CPU wants to perform any operation, suppose execution of only one instruction or even break it down one particular execution phase (like fetch instruction, write back, decode, operand fetch...

9 minutes read.

8086 Microprocessor Pin Configurations

8086 microprocessor is invented and developed by Intel in 1976. The 8086 Microprocessor is an enhanced version of the 8085 Microprocessor. There are 20 address lines and 16 data lines...

6 minutes read.

Machine Instructions

What is a Digital Computer? A computer that takes input in a binary form and produces output in binary form. The question arises of what kind of input the computer takes...

4 minutes read.

CarryLook Ahead Adder

What is Adder? Adder is the combinational circuit that is used to add the bits in digital electronics. As we know, in the digital system, every number is represented in the...

4 minutes read.

Biconnectivity in a Graph

What is a Graph? A graph is a structure where values are stored at the vertex, and the relation between vertices is denoted by edges. In a graph, if there is only...

4 minutes read.

Data Transfer and Manipulation

What is Data Transfer? In computer architecture, data transfer refers to the movement of data between different components within a computer system. These components can include the central processing unit (CPU),...

6 minutes read.

CPU Registers

CPU Registers Within the CPU, we have small- small storage units called registers. If we are executing a certain program within the CPU, there's a need to store that program content,...

11 minutes read.

Use Case Diagram for the online bank system

What is a Use Case Diagram? A tool is called a Use Case Diagram which is used to create, present, and comprehend the functional requirements for a system. The Use Case...

3 minutes read.

74138 IC DECODER

74138 DECODER Decoder A combinational circuit called a decoder can have up to 2n output lines and 'n' input lines. When a decoder is enabled, depending on the mix of inputs,...

4 minutes read.

Microprocessor classification

Introduction: Microprocessor is known as the computer processor. The IC or integrated Circuit makes the microprocessor. that is the brain of the computer machine. The microprocessor is known as the...

6 minutes read.

Computer Organization and Architecture Data Formats

Data Formats In the digital world, everything is based on digits. In every method, the calculation is processed on the digits, and most importantly, the computer only understands the binary language...

6 minutes read.

Types of Microprocessors

Introduction:Microprocessor is known as the computer processor. The IC or integrated Circuit makes the microprocessor. That is the brain of the computer machine.  The microprocessor is the Processor or CPU (Central...

3 minutes read.

Flag Register of 8086 Microprocessor

In this article, we are going to study about the one of the registers named flag registers of 8086 microprocessor. We are also going to know where and how to...

3 minutes read.

Advantages and Disadvantages of Flash Memory

What is Flash Memory? Electrically Erasable Programmable Read-Only Memory (EEPROM) and Erasable Programmable Read-Only Memory (EPROM) are used for flash memory (EEPROM). Although technically the word flash is used in the industry...

3 minutes read.

Convert a number from base 2 to base 6

Base 2 Base 2 is the format where you can represent any number with just two values which are 0 and 1. With the help of 0s and 1s, we can...

4 minutes read.

Data Path, ALU and Control Unit

Data Path, ALU(Arithmetic Logic Unit) and Control Unit What is the Data path? Suppose any data processing operation should be performed in the CPU like transferring the content of register from one...

5 minutes read.

Interfacing DAC with the 8051 Microcontroller

A wide range of applications calls for microcontrollers, including measuring and controlling physical quantities like temperature, pressure, speed, and distance. In these systems, the microcontroller creates digital output, but the controlling...

2 minutes read.

8085 Arithmetic Instructions

Arithmetic instructions are a type of instruction in a computer's instruction set that perform arithmetic operations on data. These operations can include addition, subtraction, multiplication, and division. Arithmetic instructions can...

4 minutes read.

Addressing Modes

Introduction: Addressing Modes An instruction consists of two parts opcode and operands. Opcode tells the operation going to perform, and operand information is the address of the operand. The CPU interprets...

8 minutes read.

8085 Pin Configuration

Introduction: Intel 8085 is consist 40 pin IC. The pin name of 8085 is A8 – A15; AD0 – AD7; ALE; IO/M; S0, S1; RD; WR; READY; HOLD; HLDA; INTR; INTA;...

6 minutes read.