- OS - Home
- OS - Overview
- OS - History
- OS - Evolution
- OS - Functions
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- Process Management
- Processes in Operating System
- States of a Process
- Process Schedulers
- Process Control Block
- Operations on Processes
- Process Suspension and Process Switching
- Process States and the Machine Cycle
- Inter Process Communication (IPC)
- Context Switching
- Threads
- Types of Threading
- Multi-threading
- System Calls
- Scheduling Algorithms
- Process Scheduling
- Types of Scheduling
- Scheduling Algorithms Overview
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithm
- HRRN Scheduling Algorithm
- Priority Scheduling Algorithm
- Multilevel Queue Scheduling
- Lottery Scheduling Algorithm
- Starvation and Aging
- Turn Around Time & Waiting Time
- Burst Time in SJF Scheduling
- Process Synchronization
- Process Synchronization
- Solutions For Process Synchronization
- Hardware-Based Solution
- Software-Based Solution
- Critical Section Problem
- Critical Section Synchronization
- Mutual Exclusion Synchronization
- Mutual Exclusion Using Interrupt Disabling
- Peterson's Algorithm
- Dekker's Algorithm
- Bakery Algorithm
- Semaphores
- Binary Semaphores
- Counting Semaphores
- Mutex
- Turn Variable
- Bounded Buffer Problem
- Reader Writer Locks
- Test and Set Lock
- Monitors
- Sleep and Wake
- Race Condition
- Classical Synchronization Problems
- Dining Philosophers Problem
- Producer Consumer Problem
- Sleeping Barber Problem
- Reader Writer Problem
- OS Deadlock
- Introduction to Deadlock
- Conditions for Deadlock
- Deadlock Handling
- Deadlock Prevention
- Deadlock Avoidance (Banker's Algorithm)
- Deadlock Detection and Recovery
- Deadlock Ignorance
- Resource Allocation Graph
- Livelock
- Memory Management
- Memory Management
- Logical and Physical Address
- Contiguous Memory Allocation
- Non-Contiguous Memory Allocation
- First Fit Algorithm
- Next Fit Algorithm
- Best Fit Algorithm
- Worst Fit Algorithm
- Buffering
- Fragmentation
- Compaction
- Virtual Memory
- Segmentation
- Buddy System
- Slab Allocation
- Overlays
- Free Space Management
- Locality of Reference
- Paging and Page Replacement
- Paging
- Demand Paging
- Page Table
- Page Replacement Algorithms
- Optimal Page Replacement Algorithm
- Belady's Anomaly
- Thrashing
- Storage and File Management
- File Systems
- File Attributes
- Structures of Directory
- Linked Index Allocation
- Indexed Allocation
- Disk Scheduling Algorithms
- FCFS Disk Scheduling
- SSTF Disk Scheduling
- SCAN Disk Scheduling
- LOOK Disk Scheduling
- I/O Systems
- I/O Hardware
- I/O Software
- I/O Programmed
- I/O Interrupt-Initiated
- Direct Memory Access
- OS Types
- OS - Types
- OS - Batch Processing
- OS - Multiprocessing
- OS - Hybrid
- OS - Monolithic
- OS - Zephyr
- OS - Nix
- OS - Linux
- OS - Blackberry
- OS - Garuda
- OS - Tails
- OS - Clustered
- OS - Haiku
- OS - AIX
- OS - Solus
- OS - Tizen
- OS - Bharat
- OS - Fire
- OS - Bliss
- OS - VxWorks
- OS - Embedded
- OS - Single User
- Miscellaneous Topics
- OS - Security
- OS Questions Answers
- OS - Questions Answers
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Operating System - Interrupt-Initiated I/O
Input/Output operations (I/O) are an important part of an operating system. I/O operations allows communication between the CPU and other devices such as keyboards, mouse, printers, and storage drives. There are various I/O techniques like programmed I/O, interrupt I/O and direct memory access(DMA) out of which the interrupt-initiated I/O is an efficient I/O technique compared to programmed I/O as it does not need continuous polling.
What is Interrupt-Initiated I/O?
Interrupt-initiated I/O is an I/O technique in which CPU does not continuously poll the device status. In this technique, if an I/O device is ready or has completed an operation, it will send an interrupt signal to the CPU. When CPU receives an interrupt signal, it stops the current execution of other works, saves its state, and executes the interrupt service routine (ISR) to handle the I/O operation.
After handling the interrupt, CPU resumes its previous task again. The CPU performs other tasks while waiting for the I/O operation to complete instead of continuous polling like programmed I/O.
Characteristics of Interrupt-Initiated I/O
The key characteristics of an Interrupt-Initiated I/O are −
- In this technique, CPU time is not wasted in continuous polling to check device status.
- The device sends interrupt to CPU only when required.
- I/O and CPU work independently.
- CPU responds to device events.
Key Components of Interrupt-Initiated I/O
Components of Interrupt-initiated I/O are mentioned below −
- I/O Device − Devices like keyboards, mouse, and printers that performs input or output operations.
- Device Controller − It is used to manage device operations and generate interrupt signals when needed.
- Interrupt Request Line (IRQ) − Hardware signaling line for . It is a hardware line that connects the devices to the CPU. It sends interrupt to CPU
- Interrupt Service Routine (ISR) − It is also called an interrupt handler. It is a small program that is executed in response to an interrupt.
- Interrupt Vector Table (IVT) − It is a data structure that maps interrupt numbers to ISR addresses. It stores the address of all ISRs. During an interrupt, CPU looks up the corresponding ISR address in this table.
Working of Interrupt-Initiated I/O
Here are the steps how interrupt-initiated I/O works. Below is an animation and steps to demonstrate working of Interrupt-Initiated I/O:
- First, CPU gives an I/O command to the device controller.
- Then, CPU continues to perform other task. It does not wait unlike Programmed I/O.
- The I/O operation completes at device side and the device controller sends an interrupt to the CPU.
- On receiving interrupt, CPU pauses its current task and saves its context.
- Then, CPU executes the corresponding ISR in response to the interrupt.
- After handling I/O, CPU will restore the context and resumes previous task.
Difference between Programmed and Interrupt-Initiated I/O
The differences between Programmed and Interrupt-Initiated I/O are mentioned below −
| Programmed I/O | Interrupt-Initiated I/O |
|---|---|
| In Programmed I/O, CPU continuously checks if the device is busy. | In Interrupt-Initiated I/O, CPU works independently. |
| Its efficiency is low due to polling. | It has higher efficiency than Programmed I/O as CPU does not wait here. |
| It is simple and easy to implement. | It is complex to implement as it requires extra interrupt handling hardware. |
| There is higher power consumption because of polling. | It has lower power consumption. |
| It uses polling mechanism for implementation. | It uses hardware interrupts. |
Types of OS Interrupts
The types of interrupts are given below based on source() and identification() −
Hardware Interrupts
Hardware interrupts are triggered by external or I/O devices whenever a service request is required. For example: In a keyboard if we press a key to do some action, this pressing of the keyboard generates a signal that is given to the processor to do action, such interrupts are called hardware interrupts.
Hardware interrupt are of two types −
- Maskable Interrupt − The maskable interrupts can be disabled or masked by the CPU temporarily when CPU is busy with a higher-priority task.
- Non Maskable Interrupt − The non-maskable interrupts cannot be disabled by the CPU. They are used for high-priority, such as hardware failure.
Software Interrupts
Software interrupts are generated by programs for system calls or exceptions. For example: System call invocation, file operations, and divide by zero.
Software interrupt are of two types −
- Normal Interrupts − The interrupts that are caused by the software instructions are called software instructions.
- Exception − Exceptions are an unplanned interruption while executing any program. For example: while executing a program if we got a value that is divided by zero is called an exception.
Vectored Interrupts
When an interrupt occurs, device sends a unique vector to the CPU that points to ISR address directly. These interrupts are faster.
Non-Vectored Interrupts
In non-vectored interrupts, CPU finds ISR address from interrupt vector table when an interrupt occurs. The ISR address is not provided by the device. These interrupts are Slower and requires identifying the device.
Advantages of Interrupt-Initiated I/O
The advantages of Interrupt-initiated I/O are as follows −
- Interrupt-initiated I/O is efficient in using CPU time as cpu do not waste time in polling.
- It has better system performance.
- It has fast response to device requests.
- It allows multitasking environments.
Disadvantages of Interrupt-Initiated I/O
Below are the disadvantages of Interrupt-initiated I/O −
- It requires interrupt handling hardware.
- There is increased complexity due to ISR.
- Frequent interrupts may cause interrupt overhead.
Conclusion
Interrupt-initiated I/O is an I/O technique that uses interrupt handling hardware rather than continuously polling for device status. This chapter provides a detailed explanation of Interrupt-initiated I/O, its characteristics, key components, working, differences from programmed I/O, types of interrupts, advantages, and disadvantages of Interrupt-initiated I/O.