COA Tutorial

Computer Organization and Architecture Tutorial Basic Terminologies Related to COA Digital Number System Computer Organization and Architecture Data Formats Fixed and Floating-Point Number IEEE Standard 754 Floating Point Numbers Control Unit Organization Data Path, ALU and Control Unit Micro-Operations CPU Registers Addressing Modes COA: Interrupt and its types Instruction Cycle: Computer Organization and Architecture Instruction Pipelining and Pipeline Hazards Pipelining: Computer Organization and Architecture Machine Instructions 8085 instructions set 8085 Pin Configuration Addressing mode in 8085 microprocessor Advantages and Disadvantages of Flash Memory BCD to 7 Segment Decoder Biconnectivity in a Graph Bipartite Graph CarryLook Ahead Adder Control Signals in 8155 Microprocessor Convert a number from base 2 to base 6 Ethernet Frame Format Local Broadcast Address and loopback address Microprocessor classification Use Case Diagram for the online bank system 8086 Microprocessor Pin Configurations 8255 Microprocessor Operating Modes Flag Register of 8086 Microprocessor Data Transfer and Manipulation 8085 Arithmetic Instructions Assembly Language Register What is Cache Associativity? Auxiliary Memory in COA Associative Memory in Computer Architecture SCSI Bus in Computer Architecture What are Registers in Microprocessor What is Associative Memory 1 Persistent CSMA What is Floating-Point Representation in Computer Architecture? What is a Serial Port in a Computer? What is Cluster Computing What is Batch Processing in Computer Advantages of Client Server Architecture Spooling Meaning in Computer System Magnetic Core Memory Magnetic Ink Card Reader Decision Making Tools and Techniques Digital Electronics using Semiconductor Memory What is Internal Chip Organization in Computer Architecture? What is Hardwired Control Unit? Definition of Diodes in Electronics Advantages of FSK Web Server Architecture How the OS interfaces between the user, apps, hardware? Discuss the I/O Interface in Computer Architecture Difference between Internal Fragmentation and External Fragmentation MDR in Computer Architecture

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.