Digital Principles and Computer Organization: Chapter 12: IO Systems

Interrupt-Driven I/O

1. Recognition of Interrupt and Response to Interrupt, 2. Comparison between Programmed I/O and Interrupt Driven I/O. Questions: 1. What is interrupt? 2. What is the basic difference between branch instruction a call subroutine instruction and program interrupt? 3. Discuss the general steps involved in interrupt driven data transfer. 4. How does the processor handle an interrupt request? 5. Explain the following: Hardware interrupts. 6. Write short note on Interrupts. 7. What are the steps in handling interrupts ? 8. Why are interrupt masks provided in any processor? 9. What is a non-maskable interrupt? What is the action performed on receipt of a NMI? 10. What are vectored interrupts ?ngle 11. What do you mean by interrupt nesting?

Interrupt–Driven I/O

• Sometimes it is necessary to have the computer automatically execute one of a collection of special routines whenever certain conditions exists within a program or the computer system e.g. It is necessary that computer system should give response to devices such as keyboard, sensor and other components when they request for service.


• This method provides an external asynchronous input that would inform the processor that it should complete whatever instruction that is currently being executed and fetch a new routine (Interrupt Service Routine) that will service the requesting device. Once this servicing is completed, the processor would resume exactly where it left off. The event that causes the interruption is called interrupt and the special routine executed to service the interrupt is called Interrupt Service Routine (ISR).

• The interrupt service routine is different from subroutine because the address of ISR is predefined or it is available in Interrupt Vector Table (IVT), whereas subroutine address is necessarily to be given in subroutine CALL instruction. IRET instruction is used to return from the ISR whereas RET instruction is used to return from subroutine. IRET instruction restores flag contents along with CS and IP in the IA–32 architecture; however RET instruction only restores CS and IP contents.

• An interrupt caused by an external signal is referred as a hardware interrupt.

• Conditional interrupts or interrupts caused by special instructions are called software interrupts.

Enabling and disabling interrupts

• Most of the processors provide the masking facility. In the processor those interrupts which can be masked under software control are called maskable interrupts.

The interrupts which can not be masked under software control are called non–maskable interrupts.

• Maskable interrupts are enabled and disabled under program control. By setting or resetting particular flip–flops in the processor, interrupts can be masked or unmasked, respectively.

• When masked, processor does not respond to the interrupt even though the interrupt is activated.

Vectored interrupts

• When the external device interrupts the processor (interrupt request), processor has to execute interrupt service routine for servicing that interrupt. If the internal control circuit of the processor produces a CALL to a predetermined memory location which is the starting address of interrupt service routine, then that address is called vector address and such interrupts are called vector interrupts.

For vector interrupts fastest and most flexible response is obtained since such an to direct hardware–implemented transition interrupt causes to the correct interrupt–handling program. This technique is called vectoring. When processor is interrupted, it reads the vector address and loads it into the PC.

Interrupt nesting

• For some devices, a long delay in responding to an interrupt request may cause error in the operation of computer. Such interrupts are acknowledged and serviced eventhough processor is executing an interrupt service routine for another device.

• A system of interrupts that allows an interrupt service routine to be interrupted is known as nested interrupts.

Interrupt priority

• When interrupt requests arrive from two or more devices simultaneously, the processor has to decide which request should be serviced first and which one should be delayed. The processor takes the decision with the help of interrupt priorities.

• It accepts the request having the highest priority.


1. Recognition of Interrupt and Response to Interrupt

• The CPU recognizes the interrupt when the external asynchronous input (interrupt input) is asserted (a signal is sent to the interrupt input) by an I/O device.

• In response to an interrupt a special sequence of actions are performed. These are as follows :

■ When a processor is interrupted, it stops executing its current program and calls a special routine which "services" the interrupt. The event that causes the interruption is called interrupt and the special routine which is executed is called interrupt service routine.

1. processor completes its current instruction. No instruction is cut–off in the  Middle of its execution.

2. The program counter's current contents are stored on the stack. Remember, during the execution of an instruction the program counter is pointing to the memory location for the next instruction.

3. The program counter is loaded with the address of an interrupt service routine.

4. Program execution continues with the instruction taken from the memory location pointed by the new program counter contents.

5. The interrupt program continues to execute until a return instruction is executed.

6. After execution of the RET instruction processor gets the old address (the address of the next instruction from where the interrupt service routine was called.) of the program counter form the stack and puts it back into the program counter. This allows the interrupted program to continue executing at the instruction following the one where it was interrupted. Fig. 12.3.2 shows the response to an interrupt with the flowchart diagram.



2. Comparison between Programmed I/O and Interrupt Driven I/O

Table 12.3.1 gives the comparison between programmed I/O and interrupt driven I/O.


Programmed I/O

1. In programmed I/O, processor has to check each I/O device in sequence and in effect 'ask' each one if it needs communication with the processor. This checking is achieved by continuous polling cycle and hence processor can not execute other instructions in sequence.

2. During polling processor is busy and therefore, have serious and decremental effect on system throughput.

3. It is implemented without interrupt hardware support.

4. It does not depend on interrupt status.

5. It does not need initialization of stack.

6. System throughput decreases as number of I/O devices connected in the system increases.

Interrupt driven I/O

1. External asynchronous input is used to tell the processor that I/O device needs its service and hence processor does not have to check whether I/O device needs it service or not.

2. In interrupt driven I/O, the processor is allowed to execute its instructions in sequence and only stop to service I/O device when it is told to do so by the device itself. This increases system throughput.

3. It is implemented using interrupt hardware support.

4. Interrupt must be enabled to process interrupt driven I/O.

5. It needs initialization of stack.

6. System throughput does not depend on number of I/O devices connected in the system.

 

Review Questions

1. What is interrupt?

2. What is the basic difference between branch instruction a call subroutine instruction and program interrupt?

3. Discuss the general steps involved in interrupt driven data transfer.

4. How does the processor handle an interrupt request?

5. Explain the following : Hardware interrupts.

6. Write short note on : Interrupts.

7. What are the steps in handling interrupts ?

8. Why are interrupt masks provided in any processor?

9. What is a non–maskable interrupt? What is the action performed on receipt of a NMI?

10. What are vectored interrupts ?

11. What do you mean by interrupt nesting?

 

Digital Principles and Computer Organization: Chapter 12: IO Systems : Tag: : - Interrupt-Driven I/O


Digital Principles and Computer Organization: Chapter 12: IO Systems



Under Subject


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation



Related Subjects


English Essentials II

EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation



Linear Algebra

MA25C02 2nd Semester | 2025 Regulation


Applied Physics (CSIE) II

PH25C03 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electrical and Electronics Engineering

EE25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Python for Data Science

AD25201 2nd Semester AIDS Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Re-Engineering for Innovation

ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Python for Data Science - Laboratory

AD25201 2nd Semester AIDS Dept | 2025 Regulation | 2nd Semester 2025 Regulation