BCS302 · COMPUTER ORGANIZATION AND ARCHITECTURE · Unit 5
Input / Output
Unit Scope & Exam Weightage: This unit explains how the CPU talks to the outside world: peripheral devices, the I/O interface, I/O ports, interrupt hardware and interrupt types/exceptions, the three modes of data transfer (programmed I/O, interrupt-initiated I/O and Direct Memory Access), I/O channels and processors, synchronous vs asynchronous serial communication, and standard communication interfaces. The corpus records 12 PYQ clusters worth about 74 marks — the highest-weighted unit in BCS302. DMA, interrupts and serial communication alone account for most long questions.
Front Page: Importance-Wise Topic Roadmap (2023–26 PYQs)
| Priority | Topic (Exact Syllabus) | PYQs Asked | Marks Weightage | Tag |
|---|---|---|---|---|
| 1 | Serial Communication: Synchronous & asynchronous communication | 3 (2023-24 ×2, 2025-26) |
7m + 7m + 2m | Survival Mode Diagram |
| 2 | interrupt initiated I/O and Direct Memory Access | 3 (2023-24, 2024-25, 2025-26) |
7m × 3 | Survival Mode Numerical-free |
| 3 | I/O interface | 2 (2024-25, 2025-26) |
7m × 2 | Core Concept |
| 4 | Modes of Data Transfer: Programmed I/O | 2 (2023-24 ×2) |
7m × 2 | Comparison |
| 5 | Interrupts: interrupt hardware | 1 (2025-26) |
7m | Core Concept |
| 6 | I/O ports | 1 (2024-25) |
7m | Core Concept |
| 7 | Peripheral devices | 1 (2024-25) |
2m | Core Concept |
| 8 | types of interrupts and exceptions | integrated in #5 | — | Supporting Concept |
| 9 | I/O channels and processors | 0 direct | — | Predicted |
| 10 | standard communication interfaces | 0 direct | — | Predicted |
2-Hour Last-Night Survival Checklist:
- Serial communication (#1): Draw the two frame formats. Sync = shared clock + block framing (HDLC flag, SPI/I2C); async = start bit 0 + 8 data + optional parity + stop bit 1 (UART 8N1 efficiency ).
- DMA (#2): Memorise the controller trio —
address register, word-count register, control/status— and the five-step bus hand-offDRQ → HRQ → HLDA → transfer → count=0 → interrupt. Add burst vs cycle-stealing vs transparent. - Interrupts (#5): Draw
IRQ → PIC (mask + priority encoder) → vector table → ISR → RETI; list maskable/NMI, vectored/non-vectored, hardware/software, level/edge and exceptions. - Interface and ports (#3/#6): Six functions of an I/O interface (decode, buffer, latch, synchronise, convert, report status) and the three port registers (data, status, control). State why a direct CPU–device link is impossible: speed, voltage and timing mismatch.
- Three-mode table (#4): Programmed I/O = CPU polls and wastes cycles; interrupt I/O = device interrupts, CPU still moves each word; DMA = device moves blocks directly to memory, CPU only sets up and receives completion.
1. Peripheral Devices
Peripheral device: any hardware unit attached to the computer that is not part of the CPU or main memory. It provides input, output, storage or communication capability to the system.
| Category | Devices | Function |
|---|---|---|
| Input | Keyboard, mouse, scanner, microphone, sensor, barcode reader | Convert physical information into binary data |
| Output | Monitor, printer, speaker, plotter, actuator | Convert binary results into human-visible/physical form |
| Storage | Magnetic disk, SSD, optical drive, USB flash | Retain data when power is off |
| Communication | Modem, NIC, Wi-Fi/Bluetooth module, serial adapter | Exchange data with other systems |
Interaction path: CPU → system bus → I/O interface → port registers → device controller → peripheral. The interface decodes the address, latches the data and reports status so the CPU never drives the device's analogue/electrical signals directly.
Examiner Tip: For 2 marks, "enlist" means a clean grouped list — input, output, storage, communication — with two examples per group. For the 7-mark version add the path "CPU ↔ interface ports ↔ device controller" and one concrete example such as a disk read.
After-Topic PYQ (
2024-25 Sec A Q1g— 2 Marks): Enlist the peripheral devices in a computer system?
After-Topic PYQ (
2024-25 Sec C Q7a— 7 Marks): Describe the role of peripheral devices in a computer system and explain how they interact with the CPU through I/O interfaces and ports?
2. I/O Interface
I/O interface: the collection of logic, registers and buffers between the CPU bus and a peripheral that makes their timing, voltage, data width and protocol compatible. It is the "translator" between the fast CPU and the slow device.
2.1 Functions
- Address decoding: recognises the address assigned to the device and selects its registers.
- Data buffering/latching: holds data until the receiver is ready (output latch, input three-state buffer).
- Synchronisation: converts the CPU's synchronous bus cycle into the device's asynchronous strobe/handshake.
- Speed matching: absorbs the large speed gap (CPU nanoseconds vs printer milliseconds).
- Signal/protocol conversion: parallel ↔ serial, TTL ↔ RS-232 levels, command decoding.
- Status and control: supplies READY/BUSY/ERROR flags and accepts START/RESET/enable commands.
- Interrupt/DMA support: raises an interrupt request and can hand data movement to a DMA controller.
%%{init: {'theme': 'base', 'look': 'handDrawn', 'themeVariables': {'fontFamily': "'Nunito', sans-serif", 'fontSize': '17px', 'primaryColor': '#EFEAD6', 'primaryBorderColor': '#0F766E', 'lineColor': '#23211C'}}}%%
flowchart LR
CPU["CPU<br/>address / data / control bus"] --> IF["I/O interface<br/>decode + latch + status"]
IF --> DP["Data port"]
IF --> SP["Status port"]
IF --> CP["Control port"]
DP --> DEV["Device controller<br/>keyboard / disk / printer"]
SP --> DEV
CP --> DEV
DEV -->|"IRQ / DRQ"| IF
2.2 Why an Interface Is Required
Without an interface the CPU would have to match every device's voltage level, connector, data width and response time. A slow mechanical device would stall the processor for millions of clock cycles, and a serial device could not be attached to a parallel bus at all. The interface isolates the CPU, converts formats and lets the CPU proceed with other work while the device operates at its own speed.
Examiner Tip: A 7-mark I/O-interface answer must contain the definition, at least six numbered functions, the block diagram with the three ports, and the "why required" speed/voltage/timing argument. Merely listing functions scores about half.
After-Topic PYQ (
2025-26 Sec C Q6a— 7 Marks): What is an I/O interface? Explain its functions. Why is an interface required between CPU and I/O devices?
3. I/O Ports
I/O port: an addressable register inside an I/O interface through which the CPU exchanges information with a device. A typical interface exposes a data port, a status port and a control port.
| Port | Direction | Contents | Example |
|---|---|---|---|
| Data port | Read and/or write | The actual byte/word transferred | printer character, disk sector word |
| Status port | Read only | READY, BUSY, ERROR, DATA_AVAILABLE flags | bit 7 = 1 means device ready |
| Control port | Write only | START, RESET, interrupt-enable, direction bits | write 1 to START a conversion |
Characteristics: each port has a unique address; outputs are latched, inputs are tri-stated until selected; ports may be 8-, 16- or 32-bit wide.
| Addressing style | How it works | Instruction |
|---|---|---|
| Isolated I/O | Separate I/O address space | IN/OUT |
| Memory-mapped I/O | Ports occupy ordinary memory addresses | LD/ST |
Memory-mapped I/O needs no special instructions and can use the full instruction set, but it consumes memory address space. Isolated I/O preserves memory space but needs dedicated instructions and control lines (M/IO).
Examiner Tip: State the direction of each port explicitly — status is read-only, control is write-only, data is bidirectional or chosen by direction. Then give the memory-mapped vs isolated comparison for the final marks.
After-Topic PYQ (
2024-25 Sec B Q2e— 7 Marks): Discuss the functions and characteristics of I/O ports and their significance in facilitating data exchange between the CPU and external devices?
4. Interrupts: Interrupt Hardware and Types
Interrupt: an event that temporarily diverts the CPU from its current program to a special service routine. The CPU saves its context, services the device, then returns to the interrupted instruction.
4.1 Interrupt Hardware
%%{init: {'theme': 'base', 'look': 'handDrawn', 'themeVariables': {'fontFamily': "'Nunito', sans-serif", 'fontSize': '17px', 'primaryColor': '#EFEAD6', 'primaryBorderColor': '#0F766E', 'lineColor': '#23211C'}}}%%
flowchart TD
D["Device asserts IRQ"] --> PIC["Interrupt controller<br/>mask + priority encoder"]
PIC --> CPU["CPU<br/>IF = 1 ? finish instruction"]
CPU --> SAVE["Push PC, PSW, registers"]
SAVE --> VEC["INTA → vector table<br/>fetch ISR address"]
VEC --> ISR["Execute ISR<br/>service device, clear IRQ"]
ISR --> RET["RETI → restore context"]
Hardware elements: interrupt request lines (IRQ0…IRQn), an interrupt mask/enable register, a priority encoder, a vector table, the interrupt-acknowledge cycle (INTA), and the stack used to save PC/PSW/registers.
4.2 Types of Interrupts and Exceptions
| Type | Meaning | Example |
|---|---|---|
| Maskable | Can be disabled by clearing the interrupt-enable flag | keyboard, timer, printer |
| Non-maskable (NMI) | Cannot be disabled; reserved for urgent events | power failure, hardware reset |
| Hardware vs software | Raised by a device pin vs by an instruction | IRQ vs INT n/TRAP |
| Vectored vs non-vectored | Device supplies a vector address vs fixed vector | PIC vector vs single common ISR |
| Level- vs edge-triggered | Held asserted vs a transition triggers | level IRQ vs pulse IRQ |
| Exceptions (internal) | Synchronous events from instruction execution | divide-by-zero fault, overflow trap, page fault, abort |
Service sequence: device asserts IRQ → CPU completes current instruction and checks IF → context pushed to stack → INTA obtains vector → ISR runs and clears the device request → RETI restores context and resumes. Interrupt latency is the delay from assertion to the first ISR instruction.
Examiner Tip: For the 7-mark interrupt question, write the hardware chain, the six-step service sequence, and a four-row type table. The words mask register, vector table and stack save are the examiner's keyword triggers.
After-Topic PYQ (
2025-26 Sec C Q7a— 7 Marks): Explain the concept of interrupts. Describe interrupt hardware and explain different types of interrupts.
5. Modes of Data Transfer: Programmed I/O
Programmed I/O: a transfer mode in which the CPU repeatedly reads the device status port (polling) until READY is set, then executes the data transfer itself. The CPU is entirely responsible for every byte.
POLL: read status port
if READY = 0 → branch to POLL (busy-wait)
if READY = 1 → read/write data port
update memory pointer and count
repeat until block complete
Disadvantage: the processor burns cycles in a tight loop while a slow mechanical device catches up; with several devices, polling overhead grows and real-time response is poor. Advantage: simplest hardware — no interrupt controller or DMA controller needed.
| Mode | Who checks readiness? | Who moves data? | CPU cost |
|---|---|---|---|
| Programmed I/O | CPU polls status | CPU | Highest (busy-wait) |
| Interrupt I/O | Device interrupts CPU | CPU (in ISR) | Medium (only on events) |
| DMA | Device/DMA controller | DMA controller | Lowest (setup + completion only) |
Examiner Tip: Write the polling loop as four numbered RTL-like steps and then the one-line criticism: "CPU is occupied for the whole device delay, so programmed I/O is efficient only for fast, simple devices."
After-Topic PYQ (
2023-24 Sec B Q2e— 7 Marks): What are the basic differences between interrupt initiated I/O and programmed I/O? Explain in detail.
After-Topic PYQ (
2023-24 Sec C Q7b— 7 Marks): Explain the various modes of data transfer and discuss direct memory access mode in detail. Also explain how DMA is superior to other modes.
6. Interrupt-Initiated I/O
Interrupt-initiated I/O: the device asserts an interrupt only when it is ready; the CPU continues its main program until the IRQ arrives, then runs an ISR that transfers one word or byte and returns.
main program: ... compute ... (no polling)
device: ready → assert IRQ
CPU: finish instruction → save context → vector → ISR
ISR: transfer one word; clear device flag; RETI
CPU: resume main program at saved PC
Compared with programmed I/O, the CPU is not wasted on polling, so it is suitable for sporadic devices (keyboard, mouse). It is still inefficient for bulk transfers such as disk reads, because every word requires an interrupt, context save and ISR execution.
Examiner Tip: The scored contrast is "CPU waits for device" (programmed) versus "device waits for CPU's attention by raising IRQ" (interrupt). Add the per-word ISR overhead as the reason DMA is needed for blocks.
7. Interrupt Initiated I/O and Direct Memory Access (DMA)
DMA: a mode in which a dedicated controller takes over the system bus and transfers a block of data directly between an I/O device and main memory, without the CPU in the data path. The CPU only initialises the transfer and receives a completion interrupt.
7.1 DMA Controller
| Register / signal | Role |
|---|---|
| Address register | Holds the starting memory address; auto-increments after each word |
| Word-count register | Number of words left; decrements to zero |
| Control/status register | Direction (read/write), mode, enable bit, completion flag |
| DRQ / DACK | Device request / DMA acknowledge handshake |
| HRQ / HLDA | Bus request to CPU / bus grant from CPU |
| Data buffer | Temporary latch for the word crossing the bus |
%%{init: {'theme': 'base', 'look': 'handDrawn', 'themeVariables': {'fontFamily': "'Nunito', sans-serif", 'fontSize': '17px', 'primaryColor': '#EFEAD6', 'primaryBorderColor': '#0F766E', 'lineColor': '#23211C'}}}%%
flowchart LR
CPU["CPU"] -->|"program address + count"| DMAC["DMA controller"]
DEV["I/O device"] -->|"DRQ"| DMAC
DMAC -->|"HRQ"| CPU
CPU -->|"HLDA (bus granted)"| DMAC
DMAC <-->|"data + address + RD/WR"| MEM["Main memory"]
DEV <--> DMAC
DMAC -->|"completion IRQ"| CPU
7.2 DMA Transfer Sequence
- CPU writes memory address, word count and direction into the DMA controller; enables it.
- Device asserts DRQ when it has (or needs) a word.
- DMA controller asserts HRQ; CPU finishes the current bus cycle, floats its bus drivers and returns HLDA.
- DMA controller drives address and RD/WR, moving one word (or a burst) between device and memory; it decrements the count and increments the address.
- When count , the controller releases the bus (deasserts HRQ) and raises a completion interrupt; CPU's ISR checks status.
7.3 DMA Techniques
| Technique | Bus behaviour | Use |
|---|---|---|
| Burst / block | Holds bus for the whole block | Fastest; CPU stalled for the block duration |
| Cycle stealing | Transfers one word, returns bus briefly, repeats | Balanced; CPU slowed slightly per word |
| Transparent | Transfers only when CPU is not using the bus | No CPU delay; slowest DMA |
| Scatter/gather | Controller chains descriptors for non-contiguous buffers | Advanced disk/network controllers |
Why DMA is superior: no polling loop (unlike programmed I/O), no per-word interrupt/context switch (unlike interrupt I/O), high throughput for large blocks, and the CPU is free for useful work while the transfer proceeds.
Examiner Tip: A full-credit DMA answer has three blocks: controller registers, the numbered hand-off sequence, and a comparison against both other modes. Add one numeric-style statement — "one block of N words needs one setup + one completion interrupt instead of N interrupts" — for the final mark.
After-Topic PYQ (
2025-26 Sec C Q7b— 7 Marks): Explain the working of Direct Memory Access. Describe the DMA controller and its advantages over other I/O methods.
After-Topic PYQ (
2024-25 Sec C Q7b— 7 Marks): Explain the Direct Memory Access (DMA) techniques for data transfer?
8. I/O Channels and Processors
I/O channel / I/O processor: a dedicated processor with its own instruction set and direct memory access capability that executes channel programs on behalf of the CPU and interrupts it only when a whole I/O operation finishes.
| Channel type | Behaviour | Suitable device |
|---|---|---|
| Selector | Dedicated to one device for the whole operation | High-speed disk |
| Byte multiplexer | Interleaves bytes from many slow devices | Terminals, printers |
| Block multiplexer | Transfers bursts from several devices | Tapes, multiple disks |
The CPU issues a channel command word (CCW) describing operation, memory address and count; the channel fetches and runs its own program, freeing the CPU even from DMA setup per device. Modern equivalents are intelligent disk controllers, network interface controllers and GPU copy engines.
Examiner Tip: This syllabus topic has no PYQ yet, so treat any question as predicted. Write the CCW → channel program → completion-interrupt chain and the three channel types; that is a complete answer.
9. Serial Communication: Synchronous & Asynchronous Communication
Serial communication: bits are sent one after another on a single line. In synchronous mode sender and receiver share a clock and send framed blocks; in asynchronous mode each character carries its own start/stop bits and the receiver re-synchronises on every start bit.
9.1 Frame Formats
Synchronous: [SYNC][SYNC][ data block ... ][CRC/end]
clock shared or recovered; no per-character overhead
Asynchronous: | start(0) | 8 data bits | parity(optional) | stop(1) |
line idle = 1; receiver watches for 1→0 transition
| Feature | Synchronous | Asynchronous |
|---|---|---|
| Clock | Shared / embedded, continuous | Not shared; each character self-synchronises |
| Framing | Sync characters or flags around a block | Start bit and stop bit per character |
| Overhead | Low for large blocks | 2 (or 3) extra bits per character |
| Speed | High; suited to bulk data | Lower; suited to keyboard/terminal traffic |
| Timing risk | Clock drift breaks whole frame | Resynchronised every character |
| Examples | SPI, I²C, HDLC/SDLC, SONET | UART, RS-232, classic modem links |
At 9600 baud with 8N1 the line carries 960 characters per second, of which 960 bytes are payload.
9.2 Asynchronous Data Transfer: Strobe and Handshake
Strobe control: the source places data on the lines and then sends a short strobe pulse; the destination latches data at the active strobe edge. There is no acknowledgement, so it assumes the receiver is always ready — fast but unsafe for slow devices.
Handshaking: the source asserts data and a VALID/REQ signal; the destination, after accepting, asserts ACK/READY; the source holds data until ACK arrives, then removes data and VALID; the destination finally removes ACK. No transfer can be lost.
strobe : DATA valid ────────────────┐
STROBE ┌──┐ │ (latch on pulse)
│ │
handshake: DATA valid ─────────────┐
REQ ┌────────┐ │
ACK ┌────────┘ (source now frees DATA)
Examiner Tip: Draw both frame formats and both timing sketches. For 7 marks include the 8N1 efficiency calculation, one example each (SPI vs UART), and the sentence "strobe has no acknowledgement; handshake guarantees delivery".
After-Topic PYQ (
2025-26 Sec C Q6b— 7 Marks): Define and differentiate synchronous and asynchronous communication with example.
After-Topic PYQ (
2023-24 Sec C Q7a— 7 Marks): What do you mean by asynchronous data transfer? Explain strobe control and handshaking mechanism.
After-Topic PYQ (
2023-24 Sec A Q1g— 2 Marks): In what way synchronous and asynchronous serial modes of data transfer differ?
10. Standard Communication Interfaces
Standard interface: an agreed physical and logical specification (signalling, connector, protocol, speed) that lets devices from different vendors interoperate.
| Interface | Topology / wires | Typical speed | Use |
|---|---|---|---|
| UART / RS-232 | Point-to-point, asynchronous serial | up to 115 kbit/s | Console, legacy serial |
| SPI | Master–slave, 4 wires, synchronous | 1–50 MHz | Flash memory, sensors |
| I²C | Multi-master, 2 wires, synchronous | 100 kHz–3.4 MHz | Embedded peripherals |
| USB | Host-centric, differential serial | 480 Mbit/s–10 Gbit/s+ | Keyboard, storage, cameras |
| PCIe | High-speed serial lanes | ~500 MB/s–4 GB/s per lane | Graphics, SSD, expansion |
| SATA | Serial storage link | 3/6 Gbit/s | Disks and SSDs |
| Ethernet | Packet-switched network | 100 Mbit/s–100 Gbit/s | LAN / Internet |
Examiner Tip: No PYQ exists yet on this topic. A predicted 7-mark answer should tabulate at least five interfaces under the heads topology, clocking, speed and typical device, then finish with the reason standards exist — vendor interoperability.
Solved Exam-Ready Questions
Solved Q1 (2025-26 Sec C Q6b — 7 Marks | Survival Mode)
Q: Define and differentiate synchronous and asynchronous communication with example.
Solution:
- Serial communication: bits travel one at a time on a single data line; the two modes differ in how sender and receiver agree on bit timing.
- Synchronous: both ends use a common clock (or recover it from the stream) and send a continuous framed block; sync characters/flags mark frame boundaries. No start/stop bits per character, so efficiency is high. Example: SPI or HDLC.
- Asynchronous: no common clock; the line idles at 1 and each character begins with a 0 start bit, followed by 5–8 data bits, optional parity and one or more 1 stop bits. The receiver resynchronises at every start bit. Example: UART/RS-232.
- Comparison table:
| Feature | Synchronous | Asynchronous |
|---|---|---|
| Clock | Shared/recovered | Local, resynchronised per character |
| Framing | Block with sync flags | Start + data + parity + stop |
| Overhead | Low | 2–3 bits per character |
| Throughput | High | Lower |
| Failure mode | Clock drift corrupts frame | Error confined to one character |
- Efficiency: 8N1 carries 8 useful bits in 10 line bits → 80%; at 9600 baud, 960 bytes per second.
- Use: synchronous for bulk block transfer (disk, network), asynchronous for intermittent terminal traffic.
- Conclusion: synchronous buys efficiency from a shared clock; asynchronous buys simplicity and robustness at the cost of framing overhead.
Solved Q2 (2023-24 Sec C Q7a — 7 Marks | Survival Mode)
Q: What do you mean by asynchronous data transfer? Explain strobe control and handshaking mechanism.
Solution:
- Meaning: asynchronous data transfer is not governed by a common clock; the source and destination coordinate each transfer through control signals, so either side may take as long as it needs.
- Strobe: the source puts valid data on the bus and asserts a strobe pulse; the destination latches the data on the specified strobe edge. There is no reply signal.
- Strobe strength: simplest and fastest control, minimal lines; suitable when the receiver is guaranteed ready (e.g., a latch feeding a display register).
- Strobe weakness: if the destination is still busy, the pulse is missed and data is lost; no way for the source to know.
- Handshake: source asserts DATA + VALID (REQ); destination asserts ACK only after accepting the word; source holds DATA until ACK, then deasserts VALID; destination drops ACK. Four events make one reliable transfer.
- Handshake strength/weakness: guaranteed delivery and speed-independent, but extra round-trip signals reduce throughput.
- Conclusion: strobe = "here is data, take it now"; handshake = "here is data, tell me when you have taken it" — the latter is used for slow or uncertain peripherals.
Solved Q3 (2023-24 Sec A Q1g — 2 Marks)
Q: In what way synchronous and asynchronous serial modes of data transfer differ?
Solution: Synchronous serial transfer uses a common clock and sends framed blocks with no per-character overhead (e.g., SPI, HDLC). Asynchronous serial transfer has no shared clock; each character is framed by a start bit and stop bit, so extra bits are sent but the receiver resynchronises on every character (e.g., UART). Thus the difference is clock sharing and framing overhead.
Solved Q4 (2025-26 Sec C Q6a — 7 Marks)
Q: What is an I/O interface? Explain its functions. Why is an interface required between CPU and I/O devices?
Solution:
- Definition: an I/O interface is the logic between the CPU bus and a peripheral that makes their electrical, timing and protocol characteristics compatible.
- Address decoding: selects the device when its assigned address appears on the bus.
- Buffering/latching: output registers hold data for a slow device; input tri-state buffers drive the bus only when selected.
- Synchronisation: converts CPU bus cycles into strobe/handshake cycles for asynchronous devices.
- Speed and format conversion: absorbs the speed gap and converts parallel ↔ serial and logic levels.
- Status/control: exposes READY/BUSY/ERROR status and accepts START/RESET/enable commands through ports.
- Why required + conclusion: a direct link would force the fast CPU to wait for mechanical devices and would mismatch voltages/formats. The interface isolates the CPU, offers a uniform register model and supports interrupts/DMA, so the CPU can continue useful work.
Solved Q5 (2024-25 Sec C Q7a — 7 Marks)
Q: Describe the role of peripheral devices in a computer system and explain how they interact with the CPU through I/O interfaces and ports?
Solution:
- Role: peripherals supply input, produce output, retain data and communicate with other machines; without them the CPU has no way to reach the physical world.
- Categories: input (keyboard, scanner), output (monitor, printer), storage (disk, optical drive), communication (NIC, modem).
- Path: CPU → bus → interface → data/status/control ports → device controller → peripheral.
- Port use: CPU reads the status port until READY, writes the control port to command the device, then reads/writes the data port.
- Example (disk read): CPU writes command + address + count to the disk controller; controller seeks and transfers the sector into its buffer, sets READY or raises IRQ; CPU/DMA reads the data port or memory block.
- Interrupt/DMA extension: the device signals completion by IRQ; for large blocks a DMA controller moves the data directly to memory.
- Conclusion: the interface and ports give every peripheral a uniform, software-visible register set, hiding device-specific timing and signal details from the CPU.
Solved Q6 (2024-25 Sec B Q2e — 7 Marks)
Q: Discuss the functions and characteristics of I/O ports and their significance in facilitating data exchange between the CPU and external devices?
Solution:
- Data port: bidirectional (or direction-configured) latch/buffer carrying the actual byte or word.
- Status port: read-only flags — READY, BUSY, ERROR, DATA_AVAILABLE — polled by programmed I/O or tested in an ISR.
- Control port: write-only command bits — START, RESET, interrupt enable, transfer direction.
- Characteristics: unique decoded address, latched outputs, tri-state inputs, fixed width (8/16/32 bits) and defined bit polarity.
- Addressing: isolated I/O uses
IN/OUTand a separate address space; memory-mapped I/O uses ordinaryLD/STbut consumes memory addresses. - Significance: ports turn a complex device into three simple registers, so software can control any peripheral with the same read/write pattern.
- Conclusion: the port model is the abstraction that makes programmed I/O, interrupt I/O and DMA all possible with the same hardware interface.
Solved Q7 (2025-26 Sec C Q7a — 7 Marks)
Q: Explain the concept of interrupts. Describe interrupt hardware and explain different types of interrupts.
Solution:
- Concept: an interrupt is a request that suspends the current program, runs an interrupt service routine and then returns to the exact interrupted instruction.
- Hardware: IRQ lines from devices, an interrupt controller with mask and priority encoder,
INTAacknowledge cycle, vector table, stack for PC/PSW/registers and a global interrupt-enable flag. - Sequence: assert IRQ → CPU finishes instruction → save context → obtain vector → execute ISR → clear device request →
RETIrestores context. - Maskable vs NMI: maskable IRQs can be disabled; NMI cannot and is used for power failure/reset.
- Hardware vs software: external pin requests versus
INT n/TRAPinstructions. - Vectored vs non-vectored; level vs edge: vectored supplies the ISR address, non-vectored uses one fixed address; level lines stay asserted, edge lines trigger on transition.
- Exceptions: internal synchronous events — divide-by-zero fault, overflow trap, page fault, abort — use the same vector mechanism.
Solved Q8 (2023-24 Sec B Q2e — 7 Marks)
Q: What are the basic differences between interrupt initiated I/O and programmed I/O? Explain in detail.
Solution:
- Programmed I/O: the CPU polls the status port in a loop until READY, then transfers the data itself; the device never signals the CPU.
- Interrupt I/O: the CPU runs its main program; the device asserts IRQ only when ready, and the CPU services it in an ISR.
- CPU time: programmed I/O wastes cycles in busy-wait; interrupt I/O uses CPU only when an event occurs.
- Data movement: in both modes the CPU moves every byte/word; neither removes the CPU from the data path.
- Hardware: programmed I/O needs only status/control ports; interrupt I/O additionally needs IRQ lines, a controller, vectors and stack support.
- Latency and suitability: polling gives predictable but wasteful service; interrupts give fast response to sporadic events but per-word ISR overhead is high for bulk transfers.
- Conclusion: programmed I/O suits fast/simple devices; interrupt I/O suits slow/sporadic devices; DMA is preferred for large blocks.
Solved Q9 (2023-24 Sec C Q7b — 7 Marks)
Q: Explain the various modes of data transfer and discuss direct memory access mode in detail. Also explain how DMA is superior to other modes.
Solution:
- Programmed I/O: CPU polls and transfers each word; simple but wastes CPU time.
- Interrupt I/O: device interrupts when ready; CPU transfers each word in an ISR; no polling but per-word overhead.
- DMA: DMA controller takes the bus and transfers a block directly between device and memory; CPU only sets up and receives completion.
- Channel I/O: a dedicated I/O processor runs its own channel program — the most autonomous form.
- DMA hardware: address register, word-count register, control/status, DRQ/DACK and HRQ/HLDA handshake.
- DMA steps: program → DRQ → HRQ → HLDA → transfer and decrement → count zero → release bus + completion IRQ.
- Superiority: no polling, no per-word ISR/context switch, very high block throughput and the CPU is free for computation during the transfer.
Solved Q10 (2025-26 Sec C Q7b — 7 Marks)
Q: Explain the working of Direct Memory Access. Describe the DMA controller and its advantages over other I/O methods.
Solution:
- Working: the CPU programs the controller with memory address, word count and direction; the device requests a transfer; the controller borrows the bus and moves words directly to/from memory; it interrupts the CPU on completion.
- Address register: supplies the current memory address and auto-increments.
- Word-count register: decremented after each transfer; zero signals completion.
- Control/status register: stores direction, mode, enable and completion flags.
- Bus handshake: DRQ/DACK with the device; HRQ/HLDA with the CPU. The CPU floats its drivers while the DMA controller drives the bus.
- Advantages: CPU is removed from the data path; one setup and one completion interrupt replace N polling checks or N interrupts; maximum throughput for disk/network blocks.
- Conclusion: DMA is the standard choice whenever a device transfers large contiguous blocks, with cycle-stealing or burst mode selected according to how much CPU delay is tolerable.
Solved Q11 (2024-25 Sec C Q7b — 7 Marks)
Q: Explain the Direct Memory Access (DMA) techniques for data transfer?
Solution:
- Burst (block) mode: after bus grant the controller holds the bus until the entire block finishes. Fastest transfer; CPU is stalled for the whole burst.
- Cycle-stealing mode: the controller transfers one word, releases the bus for one CPU cycle, then steals the next cycle. CPU slows slightly but is not stopped for long.
- Transparent mode: DMA transfers occur only in bus idle slots when the CPU is not using the bus; no CPU delay, but transfers take longest.
- Register setup: address, count and direction are loaded by the CPU before any mode begins.
- Handshake: DRQ from device, HRQ to CPU, HLDA grant, DACK to device; completion raises IRQ.
- Comparison table:
| Mode | Bus ownership | CPU impact | Speed |
|---|---|---|---|
| Burst | Whole block | Max stall | Highest |
| Cycle stealing | One word at a time | Small per-word delay | Medium |
| Transparent | Idle cycles only | None | Lowest |
- Conclusion: choose burst for maximum device throughput, cycle stealing for balanced systems, transparent when CPU responsiveness dominates.
Solved Q12 (2024-25 Sec A Q1g — 2 Marks)
Q: Enlist the peripheral devices in a computer system?
Solution: Input — keyboard, mouse, scanner, microphone; Output — monitor, printer, speaker; Storage — magnetic disk, SSD, optical drive, USB flash; Communication — modem, NIC, Bluetooth/Wi-Fi adapter. All attach to the CPU through an I/O interface and its data, status and control ports.
Practice Questions (Self-Test)
- (2 Marks) What is an I/O interface? Give two of its functions.
- (2 Marks) Name the three ports of a typical I/O interface and state the direction of each.
- (7 Marks) Draw the interrupt hardware chain and explain the six-step service sequence.
- (7 Marks) Compare programmed I/O, interrupt I/O and DMA under the heads readiness check, data mover, CPU cost and use.
- (7 Marks) Draw a DMA controller block diagram and label address, count, control, DRQ/DACK and HRQ/HLDA.
- (7 Marks) Explain burst, cycle-stealing and transparent DMA with a timing sketch for each.
- (7 Marks) Draw synchronous and asynchronous serial frame formats and compute the efficiency of 8N1.
- (7 Marks) Explain strobe control and handshaking with timing diagrams and one sentence on reliability.
- (7 Marks) Differentiate memory-mapped I/O from isolated I/O with an example instruction sequence.
- (7 Marks) Explain I/O channels and processors with the three channel types; state why this topic is predicted rather than PYQ-backed.