Interrupt Driven I/O – Point-Wise Explanation
Definition and Working:
o The signal/event that causes the interruption is called an interrupt.
o The special routine executed to handle the interrupt is called an Interrupt Service
Routine (ISR) or Interrupt Service Procedure.
o When an interrupt occurs, the processor stops executing the current program and
services the interrupt.
1. Need for Interrupt Driven I/O:
o Computers must sometimes execute special routines automatically when specific
conditions occur within a program or system.
o For example, it is important for the system to respond to devices like keyboards,
sensors, and other components when they request service.
2. Polled Approach (Conventional Method):
o In this method, the processor tests each device in sequence to check if it needs
communication.
o The main program continuously loops through this polling cycle.
o Drawbacks:
Wastes a significant amount of CPU time.
Reduces system throughput.
Limits the ability of the computer to perform other tasks.
Lowers cost-effectiveness due to inefficient CPU usage.
3. Interrupt Method (Desirable Method):
o Processor continues with its main program and only stops when a device signals that
it needs service.
o An external asynchronous input is used to inform the processor.
o The processor:
Completes the current instruction.
Executes a new routine (called Interrupt Service Routine – ISR) to service
the device.
Then resumes the main program from where it left off.
4. Advantages of Interrupt Method:
o Significantly increases system throughput.
o Enhances cost-effectiveness.
o Allows better CPU utilization.
Normal program is interrupted by 3 ways:
1.By external signals : Hardware interrupt
2.By a special instruction in the program: Software interrupt
3.By the occurrence of some special condition: Software interrupt
Characteristics of Memory System
1. Memory Types Based on Location
A. Internal Memory
These are located inside the computer and directly accessible by the processor.
Processor Registers
Cache Memory
Main Memory (RAM – Random Access Memory)
o RAM in desktops, laptops, etc.
ROM (Read-Only Memory)
Flash Memory (used in BIOS, embedded systems, etc.)
B. External Memory
These are storage devices located outside the processor and used for long-term data storage.
Optical Disks (CDs, DVDs)
Tape Drives
Magnetic Disks (Hard Disk Drives – HDDs)
USB Flash Drives (Pen Drives)
Memory Cards (SD Cards, microSD Cards)
2. Unit of Transfer
Definition: refers to the amount of data that can be transferred to or from memory in a single
operation.
a. Main Memory (RAM)
The unit of transfer is the number of bits or words read or written at one time.
Typically aligned with the word length of the system (e.g., 32-bit, 64-bit).
b. Internal Memory
The unit of transfer is determined by the number of electrical data lines to/from the
memory module.
May equal the word length but often larger.
Common Sizes: 64 bits, 128 bits, or 256 bits.
c. External Memory
The unit of transfer is typically a Block.
A block is the smallest chunk of data that can be read/written in one operation.
Typical Block Sizes:
o 512 bytes (older systems)
o 4096 bytes (4 KB) (modern HDDs and SSDs)
Memory Capacity (Characteristic of Memory System)
Memory capacity defines how much data a memory system can hold and access. It is measured using
the following parameters:
A. Number of Words
A word is the basic unit of data that a processor can handle.
The word size is typically equal to the number of bits used to represent an integer or
instruction.
Common word sizes depend on the CPU architecture:
o 16-bit, 32-bit, or 64-bit systems.
B. Number of Blocks
A block is a larger unit used for data transfer between memory and cache or storage.
Block size is generally a multiple of words (e.g., 64 bytes, 128 bytes).
Used in memory hierarchy for efficient caching and memory management.
Example:
o If 1 word = 4 bytes and block size = 64 bytes,
→ Number of words per block = 64 / 4 = 16 words
C. Addressable Units
Addressable unit: The smallest chunk of memory that can be uniquely addressed by the
system.
Two common types:
o Word-addressable systems: Each memory address points to a word.
o Byte-addressable systems: Each memory address points to a single byte (most
common today).
4. Method of Accessing Units of Data
This characteristic refers to how data is accessed or retrieved from a memory system.
A. Sequential Access
Data is organized into records.
Access must occur in a specific linear sequence—one after another.
Skipping directly to the desired data is not possible.
Slower form of access.
Examples:
o Magnetic tape drives
o Video or audio playback systems (like cassettes)
B. Direct Access
Data is still accessed using a read/write mechanism, but you can move directly to a specific
block.
Faster than sequential access, but still not truly random.
Often used in devices that store data in blocks.
Examples:
o Hard Disk Drives (HDDs)
o Solid State Drives (SSDs)
o CDs, DVDs
C. Random Access
Each location has a unique address and can be accessed independently and directly.
Data retrieval does not require a sequence.
Very fast access speed.
Examples:
o RAM (Random Access Memory)
D. Associative (Content-Addressable) Access
A form of random access, but data is retrieved based on content rather than a specific
address.
The system compares the desired content with all words simultaneously.
Efficient for fast lookup and matching operations.
Examples:
o Cache Memory
o Translation Lookaside Buffer (TLB)
o Routers, Firewalls
o Packet filters, CPU cache tags
Summary Table:
Access Type Access Method Speed Examples
Sequential Access Linear, one-by-one Slow Tape drives, media playback
Direct Access Block-level, movable head Moderate HDDs, SSDs, CDs, DVDs
Random Access Address-based, direct Fast RAM
Associative Access Content-based, parallel match Very Fast Cache, TLB, routers, firewalls
5. Memory Capacity and Performance
Two of the most important characteristics of a memory system are its capacity and performance.
A. Capacity
Refers to the maximum amount of data the memory can store.
Measured in terms of:
o Number of addressable units (bytes or words)
o Word size (e.g., 8, 16, 32, or 64 bits)
o Number of blocks (for memory transfers)
Example: A 4 GB RAM can store 4 × 2³⁰ bytes of data.
B. Performance
Memory performance is primarily measured using the following three parameters:
1. Access Time (Latency)
Definition: The time taken to perform a read or write operation.
It is the interval from the moment an address is presented to the memory until the
requested data is available (for read) or written (for write).
Applies to: Mostly Random Access Memory (RAM) and similar memory types.
Lower access time = faster memory.
2. Memory Cycle Time
Definition: The total time required before a second memory operation (read or write) can
begin.
Includes:
o Access Time
o Additional recovery time (for signal stabilization or data regeneration)
Determines how often memory can be accessed.
Cycle Time ≥ Access Time
Note: Even if a processor is fast, it must wait for memory to complete its current cycle
before performing another operation.
Illustration: Access Time vs Cycle Time
Parameter Definition Use
Time to read/write a data unit once address is Speed of individual
Access Time
given operation
Memory Cycle Time Time before another operation can start Frequency of operations
3. Transfer Rate
Definition:
The transfer rate is the rate at which data can be moved into or out of a memory unit.
Purpose:
Indicates how fast memory can communicate with the CPU or other components.
A. Transfer Rate for Random-Access Memory (RAM)
Since each read/write operation takes one full cycle, the transfer rate is inversely
proportional to the cycle time.
Faster cycle time = Higher transfer rate
PYQs
1.The access method used in cache memory: Associative access.
2. consider a system with three I/O devices: a printer, a disk, and a communications line, with
increasing priorities of 2,
4, and 5, respectively. Figure 3.14, based on an example in illustrates a possible sequence. A
user program begins at t=0. At t=10, a printer interrupt occurs; user information is placed on
the system stack and execution continues at the printer interrupt service routine (ISR).While
this routine is still executing, at t=15, a communications interrupt occurs. Because the
communications line has higher priority than the printer, the interrupt is honored. The
printer ISR is interrupted, its state is pushed onto the stack, and execution continues at the
communications ISR. While this routine is executing, a disk interrupt occurs (t=20). Because
this interrupt is of lower priority, it is simply held, and the communications ISR runs to
completion.
When the communications ISR is complete (t =25), the previous processor state is restored,
which is the execution of the printer ISR. However, before even a single instruction in that
routine can be executed, the processor honors the higher priority disk interrupt and control
transfers to the disk ISR. Only when that routine is complete (t=35) is the printer ISR
resumed. When that routine completes (t=40), control finally returns to the user program.