By the end of this chapter you'll be able to…

  • 1State the two questions that separate the three I/O methods
  • 2Compute the wasted cycles of a polling loop
  • 3State when programmed I/O is nevertheless the right choice
  • 4Describe the sequence of events when an interrupt is recognised
  • 5Explain why interrupts are recognised at instruction boundaries
  • 6Compare vectored and non-vectored interrupt identification
  • 7Compare daisy-chain and independent-request priority resolution
  • 8State what a non-maskable interrupt is reserved for
  • 9Explain the condition for safely nesting interrupts
  • 10Describe how a DMA controller is set up and what it does
  • 11Explain why DMA converts per-byte overhead into per-block overhead
  • 12Explain cycle stealing and distinguish it from an interrupt
  • 13Compare cycle-stealing, burst and transparent DMA modes
  • 14Compare memory-mapped and isolated I/O addressing
  • 15Explain why memory-mapped device registers must be non-cacheable
  • 16Explain the cache coherence hazard created by DMA writes
  • 17Compare daisy-chain, polling and independent-request bus arbitration
  • 18Compare synchronous and asynchronous bus timing
  • 19Explain why wait states are the usual practical compromise
💡
Why this chapter matters in GATE
Input and output are slow by many orders of magnitude: a processor executes an instruction in a nanosecond while a disk answers in milliseconds. Every technique in this chapter exists to stop that gap from wasting processor time, and two questions separate the three methods — who waits for the device to become ready, and who actually moves each byte between device and memory. Programmed I/O has the processor do both. Interrupt-driven I/O lets the device wait but keeps the processor moving bytes. DMA removes the processor from both roles, leaving it only to set up the transfer and receive one completion interrupt. Each step down that ladder removes the processor from more of the work at the cost of more hardware in the controller, and almost every question in this area is asking which row applies or what it costs. The residual cost of DMA is worth stating precisely, because it is the one thing DMA cannot avoid: cycle stealing consumes bus cycles, not processor instructions.

Before you start — revise these

🔗
ALU, Data-path & Control Unit
Interrupt recognition at instruction boundaries and the state saved on entry follow directly from the instruction cycle developed there.
🔗
Memory Hierarchy: Cache & Main Memory
The non-cacheable requirement for device registers and the coherence hazard from DMA writes both depend on how caching works.

I/O Interface: Interrupt & DMA Mode

Input and output are slow by many orders of magnitude. A processor executes an instruction in a nanosecond; a disk answers a request in milliseconds. Every technique in this chapter exists to stop that gap from wasting processor time.

Two questions separate the three transfer methods. Who waits for the device to become ready — the processor, or the device itself? And who actually moves each byte between the device and memory?

MethodWho waitsWho moves the data
Programmed I/OProcessorProcessor
Interrupt-driven I/ODeviceProcessor
DMADeviceDMA controller

Each step down that table removes the processor from more of the work, and the cost is more hardware in the controller.

That single table organises the whole topic, and almost every question is asking which row applies or what it costs.

1. Programmed I/O

The processor checks a status register in a loop until the device reports readiness, then transfers a byte itself.

The loop is the problem. During it the processor executes instructions that accomplish nothing, and the number of wasted instructions is the device latency divided by the loop iteration time.

For a device ready every millisecond and a loop taking 100 nanoseconds, the processor executes about 10,000 useless iterations per byte.

Programmed I/O is nevertheless correct and sometimes right. It has no hardware cost beyond a status register, its timing is completely predictable, and for a device that is almost always ready — or in an embedded system with nothing else to do — polling can beat the overhead of an interrupt.

2. Interrupt-Driven I/O

The device signals the processor when it becomes ready, so the processor does other work in the meantime.

The processor checks for a pending interrupt at the end of every instruction, which is why interrupts are recognised between instructions rather than during one, and why a long instruction delays recognition.

On recognising an interrupt, the hardware saves enough state to resume — at minimum the program counter and status flags — disables further interrupts, and jumps to the service routine. The routine saves any registers it will use, transfers the byte, acknowledges the device, restores the registers and returns.

The saving is real but not total. Each transfer now costs a context save, the service routine and a context restore, typically tens to hundreds of cycles, instead of thousands of polling iterations — but still per byte.

That per-byte overhead is precisely what DMA removes.

3. Interrupt Structure

Several devices may interrupt, so the mechanism must identify the source and resolve simultaneous requests.

Non-vectored interrupts jump to a fixed address, and the routine there polls each device to find which one signalled. Simple, and slow in proportion to the number of devices.

Vectored interrupts have the device supply an identifier, which indexes an interrupt vector table holding the address of the correct routine. Identification costs one table lookup regardless of the number of devices.

Priority resolution takes two forms.

Daisy chaining passes an acknowledge signal physically through the devices in series. The first device that requested service intercepts it, so priority is fixed by physical position on the chain. It is cheap — one signal line — and inflexible.

Independent requesting gives each device its own request and acknowledge line, with a priority encoder resolving conflicts. Priority is programmable and identification is immediate, at the cost of two lines per device.

A maskable interrupt can be disabled by software, which is what allows a critical section to run without interference. A non-maskable interrupt cannot, and is reserved for conditions where ignoring the signal would be worse than any timing disruption — power failure, memory parity error.

Nested interrupts are permitted by re-enabling interrupts inside a service routine, but only for higher-priority sources, or a low-priority device could preempt a high-priority one.

4. Direct Memory Access

A DMA controller moves data between the device and memory without the processor touching each byte.

The processor sets up the transfer and is then uninvolved until it completes. It writes the memory address, the transfer count and the direction into the controller's registers, and issues a start command.

The controller then requests the bus, transfers a word, increments the address, decrements the count, and repeats. When the count reaches zero it raises a single interrupt, so the processor is interrupted once per block rather than once per byte.

That is the entire benefit: the per-byte overhead becomes a per-block overhead.

The controller and the processor both need the bus, and this is the one cost DMA cannot avoid. Each transferred word requires one bus cycle that the processor cannot use, which is called cycle stealing.

The processor is not interrupted in the software sense — no context is saved and no routine runs — but it does stall for that cycle if it needed the bus then.

5. DMA Transfer Modes

Three modes differ in how the controller shares the bus.

ModeBehaviourEffect on processor
Cycle stealingOne word per bus acquisitionSlight slowdown, spread out
Burst (block)Whole block in one acquisitionProcessor stalls for the duration
TransparentTransfers only in cycles the processor does not use the busNo slowdown, slowest transfer

Cycle stealing is the usual compromise. The controller takes one bus cycle, releases it, and requests again for the next word, so the processor's slowdown is spread thinly rather than concentrated.

Burst mode gives the fastest transfer and the worst latency for everything else, which suits a device that must not be starved — a disk with a rotating platter cannot wait.

Transparent mode is free but slow, and it is practical only when the processor leaves enough bus cycles idle, which a cache-equipped processor often does.

The distinction to hold is that cycle stealing steals bus cycles, not instructions: the processor keeps executing whenever it does not need the bus.

6. I/O Addressing

Two schemes decide how the processor names a device register.

Memory-mapped I/O places device registers in the ordinary memory address space. Any instruction that can access memory can access a device, so no special instructions are needed and the full range of addressing modes applies.

The cost is address space: every address given to a device is unavailable to memory. On a machine with a small address space this matters, and on a large one it does not.

Isolated or port-mapped I/O gives devices a separate address space reached by dedicated instructions, and a control line tells the system which space an address refers to.

The full memory space stays available, and device accesses are visibly distinct in the instruction stream, which helps protection. The cost is extra instructions, extra control lines, and the loss of general addressing modes on device registers.

Memory-mapped I/O also interacts with caching, and the interaction is a real hazard. A device register whose value changes on its own must never be cached, since a cached copy would hide the change. Such regions are therefore marked non-cacheable, which is a requirement the isolated scheme avoids by construction.

7. Buses and Arbitration

A bus is a shared set of lines, and sharing requires arbitration: deciding which master drives it next.

Daisy-chain arbitration passes a grant signal serially, giving fixed priority by position, with one line.

Polling arbitration has the arbiter address each master in turn on a set of poll lines; priority is programmable by changing the polling order, at the cost of lines.

Independent request arbitration gives each master its own request and grant pair, resolving with a priority encoder. It is fastest and needs lines.

The pattern matches interrupt priority resolution exactly, because it is the same problem: several requesters, one resource, and a choice between wiring cost and flexibility.

A synchronous bus times every transfer against a shared clock, which is simple and fast but forces every device to complete within the fixed period, so the slowest device sets the pace.

An asynchronous bus uses a handshake — request and acknowledge — so each transfer takes exactly as long as the device needs. Fast devices are not slowed by slow ones, at the cost of the handshake overhead on every transfer.

8. Worked Examples

Example 1. A device transfers data at 40 KB per second. Compare the processor overhead under programmed I/O, interrupt-driven I/O costing 60 cycles per byte, and DMA costing 800 cycles per 4 KB block, on a 2 GHz processor.

Under programmed I/O the processor is fully occupied polling, so the overhead is effectively 100 per cent of the time the transfer is active. No useful work proceeds.

Under interrupt-driven I/O the device delivers 40,000 bytes per second, each costing 60 cycles.

Cycles per second million.

As a fraction of 2 GHz, that is per cent.

Under DMA, 40 KB per second is 10 blocks of 4 KB per second, each costing 800 cycles of setup and completion handling.

Cycles per second , which is per cent of the processor.

Interrupt-driven I/O reduces the overhead by three orders of magnitude compared with polling, and DMA reduces it by another 300 times. The remaining DMA cost is cycle stealing on the bus, which this calculation excludes because it is a bus-bandwidth cost rather than a processor-time cost.

Example 2. A DMA controller transfers 4 KB blocks using cycle stealing on a 32-bit bus, with each bus cycle taking 10 ns. How much bus time does one block consume, and what fraction of the bus does a 5 MB per second stream occupy?

A 32-bit bus moves 4 bytes per cycle, so a 4 KB block needs bus cycles.

At 10 ns each, one block occupies ns, about 10.24 microseconds.

A 5 MB per second stream is blocks per second.

Bus time consumed per second , which is 12.5 ms.

As a fraction of one second, that is 1.25 per cent of the bus.

The processor therefore retains almost 99 per cent of the bus bandwidth, which is why cycle-stealing DMA is described as causing only a slight slowdown. The figure would be far worse with an 8-bit bus, which would need four times as many cycles for the same data.

Example 3. Four devices are daisy chained for interrupt priority. Devices 2 and 4 request service simultaneously. Which is served, and what changes with independent requesting?

In a daisy chain, the acknowledge signal passes through the devices in physical order, and the first device that has an outstanding request intercepts it.

Device 2 is earlier in the chain than device 4, so device 2 intercepts the acknowledge and is served. Device 4's request remains pending until the chain is re-enabled.

Priority is therefore fixed by physical position, and changing it means physically rewiring the chain.

With independent requesting, each device has its own request line into a priority encoder. The encoder resolves the conflict according to whatever priority the encoder implements, which can be programmable.

If device 4 were configured as higher priority, it would be served first — an impossibility in the daisy chain without rewiring.

The trade is wiring: a daisy chain needs one acknowledge line for any number of devices, while independent requesting needs a request and an acknowledge line each, so eight lines for four devices.

Example 4. Why does a memory-mapped device register have to be marked non-cacheable, and what goes wrong if it is not?

A cache exists on the assumption that memory changes only when the processor writes to it. A device register violates that assumption, because the device can change the register's value on its own — a status bit setting when data arrives, for instance.

If the register were cacheable, the first read would fetch the value into the cache. Every subsequent read would hit in the cache and return the stale copy, and the processor would never observe the device becoming ready.

A polling loop would spin forever on a value that stopped reflecting reality.

Writes have a mirror problem under a write-back cache. A command written to a device register would sit in the cache marked dirty and reach the device only on eviction, at an unpredictable time — or never, if the line is discarded.

The fix is to mark the address region non-cacheable, so every access goes to the device. Isolated I/O avoids the issue by construction, since device accesses use a separate address space that the cache does not cover.

The same hazard appears with DMA even without device registers. A DMA controller writing to memory bypasses the cache, so a cached copy of that memory becomes stale, which is why systems must either invalidate the affected lines or route DMA through a coherent path.

Example 5. A processor polls a keyboard that produces a character every 100 ms, with a poll loop of 5 instructions taking 4 ns total. Compute the wasted instructions per character and the fraction of processor time consumed if 10 such devices are polled.

The loop takes 4 ns and must run until the device is ready, which is up to 100 ms.

Iterations per character million.

At 5 instructions each, that is 125 million wasted instructions per character.

For 10 devices polled in rotation, the processor spends essentially all of its time in the polling loop, since it never has an opportunity to do anything else.

Contrast with interrupts. At a service cost of, say, 200 cycles per character and 10 characters per second across all devices, the total is 2,000 cycles per second, which on a 2 GHz processor is one part in a million.

The arithmetic explains why interactive devices were the original motivation for interrupts: their data rates are trivially low but their latencies are enormous, which is the worst possible case for polling.

Example 6. Compare synchronous and asynchronous bus timing for a system containing both a 5 ns memory and a 200 ns device.

On a synchronous bus, every transfer occupies a fixed number of clock periods, and the period must be long enough for the slowest device to respond.

With a 200 ns device, the clock period must accommodate it, so even an access to the 5 ns memory takes the full period. The fast memory is slowed by a factor of 40 by the presence of the slow device.

A common mitigation is wait states: the bus runs at the fast period, and slow devices assert a wait signal that extends their own transfers by whole clock periods. This recovers most of the fast memory's speed at the cost of a wait mechanism.

On an asynchronous bus, each transfer uses a request-acknowledge handshake, so it completes as soon as the responding device signals completion.

The memory access finishes in roughly 5 ns plus handshake overhead, and the device access takes 200 ns plus the same overhead. Neither is slowed by the other.

The cost is that handshake overhead on every transfer, which for the fast memory may be comparable to the access itself, and the greater complexity of the control logic. This is why real systems commonly use a synchronous bus with wait states rather than a fully asynchronous one.

Summary

Every I/O method answers two questions: who waits for the device, and who moves the bytes.

Programmed I/O has the processor do both, wasting cycles in proportion to device latency, but costs no hardware and is predictable.

Interrupt-driven I/O lets the device wait, reducing overhead to a context save and service routine per byte, and interrupts are recognised at instruction boundaries.

Vectored interrupts identify the source by table lookup; non-vectored ones poll. Daisy chaining fixes priority by physical position with one line, while independent requesting makes it programmable at two lines per device.

Non-maskable interrupts exist for conditions where ignoring the signal is worse than any timing disruption.

DMA removes the processor from the per-byte path entirely: it sets up the transfer and receives one interrupt per block. The residual cost is cycle stealing on the bus, not processor time.

Cycle-stealing mode spreads the slowdown thinly, burst mode transfers fastest but stalls everything else, and transparent mode is free but slow.

Memory-mapped I/O costs address space and requires non-cacheable regions; isolated I/O keeps the memory space intact at the cost of special instructions and control lines.

Bus arbitration mirrors interrupt priority exactly, with the same trade between wiring cost and flexibility.

A synchronous bus is simple but paced by its slowest device unless wait states are added; an asynchronous bus lets each transfer take the time it needs, at a handshake cost on every one.

Key formulas & results

Everything to memorise for the exam hall, in one card. Screenshot this for revision.

The organising tool
TWO QUESTIONS SEPARATE THE METHODS: WHO WAITS FOR THE DEVICE, AND WHO MOVES THE BYTES.
PROGRAMMED I/O: PROCESSOR WAITS AND MOVES. INTERRUPT-DRIVEN: DEVICE WAITS, PROCESSOR MOVES. DMA: DEVICE WAITS AND THE CONTROLLER MOVES.
Cost of polling
WASTED ITERATIONS PER BYTE EQUALS DEVICE LATENCY DIVIDED BY LOOP ITERATION TIME.
A DEVICE READY EVERY MILLISECOND WITH A 100 NANOSECOND LOOP WASTES ABOUT 10,000 ITERATIONS PER BYTE, ACCOMPLISHING NOTHING.
When programmed I/O is right
NO HARDWARE COST BEYOND A STATUS REGISTER, COMPLETELY PREDICTABLE TIMING, AND NO INTERRUPT OVERHEAD.
FOR A DEVICE THAT IS ALMOST ALWAYS READY, OR IN AN EMBEDDED SYSTEM WITH NOTHING ELSE TO DO, POLLING CAN BEAT THE COST OF AN INTERRUPT.
Interrupt sequence
THE PROCESSOR CHECKS FOR A PENDING INTERRUPT AT THE END OF EVERY INSTRUCTION, SAVES THE PROGRAM COUNTER AND FLAGS, DISABLES FURTHER INTERRUPTS, AND JUMPS TO THE SERVICE ROUTINE.
THE ROUTINE SAVES THE REGISTERS IT WILL USE, TRANSFERS THE DATA, ACKNOWLEDGES THE DEVICE, RESTORES AND RETURNS.
Why boundaries
INTERRUPTS ARE RECOGNISED BETWEEN INSTRUCTIONS BECAUSE ONLY THERE IS THE VISIBLE STATE SUFFICIENT TO RESUME FROM.
THE COST IS INTERRUPT LATENCY: A LONG INSTRUCTION DELAYS RECOGNITION UNTIL IT COMPLETES.
Vectored versus non-vectored
NON-VECTORED INTERRUPTS JUMP TO A FIXED ADDRESS AND POLL EACH DEVICE. VECTORED INTERRUPTS HAVE THE DEVICE SUPPLY AN IDENTIFIER THAT INDEXES A VECTOR TABLE.
IDENTIFICATION COSTS ONE TABLE LOOKUP REGARDLESS OF THE NUMBER OF DEVICES, RATHER THAN A POLL PROPORTIONAL TO IT.
Priority resolution
DAISY CHAINING PASSES AN ACKNOWLEDGE SIGNAL SERIALLY, SO PRIORITY IS FIXED BY PHYSICAL POSITION AND COSTS ONE LINE. INDEPENDENT REQUESTING GIVES EACH DEVICE A REQUEST AND ACKNOWLEDGE PAIR RESOLVED BY A PRIORITY ENCODER.
INDEPENDENT REQUESTING MAKES PRIORITY PROGRAMMABLE AND IDENTIFICATION IMMEDIATE, AT TWO LINES PER DEVICE.
Maskable and non-maskable
A MASKABLE INTERRUPT CAN BE DISABLED BY SOFTWARE, WHICH IS WHAT LETS A CRITICAL SECTION RUN UNDISTURBED. A NON-MASKABLE INTERRUPT CANNOT.
NON-MASKABLE IS RESERVED FOR CONDITIONS WHERE IGNORING THE SIGNAL WOULD BE WORSE THAN ANY TIMING DISRUPTION, SUCH AS POWER FAILURE OR A PARITY ERROR.
Nesting interrupts
INTERRUPTS MAY BE RE-ENABLED INSIDE A SERVICE ROUTINE, BUT ONLY FOR HIGHER-PRIORITY SOURCES.
OTHERWISE A LOW-PRIORITY DEVICE COULD PREEMPT A HIGH-PRIORITY ONE, WHICH DEFEATS THE POINT OF HAVING PRIORITIES.
DMA setup
THE PROCESSOR WRITES THE MEMORY ADDRESS, TRANSFER COUNT AND DIRECTION INTO THE CONTROLLER AND ISSUES A START COMMAND, THEN IS UNINVOLVED UNTIL COMPLETION.
THE CONTROLLER REQUESTS THE BUS, TRANSFERS A WORD, INCREMENTS THE ADDRESS, DECREMENTS THE COUNT, AND RAISES A SINGLE INTERRUPT WHEN THE COUNT REACHES ZERO.
The DMA benefit
PER-BYTE OVERHEAD BECOMES PER-BLOCK OVERHEAD.
ONE INTERRUPT PER BLOCK REPLACES ONE INTERRUPT PER BYTE, WHICH FOR A 4 KB BLOCK IS A REDUCTION OF THREE ORDERS OF MAGNITUDE.
Cycle stealing
EACH TRANSFERRED WORD REQUIRES ONE BUS CYCLE THAT THE PROCESSOR CANNOT USE.
THE PROCESSOR IS NOT INTERRUPTED IN THE SOFTWARE SENSE — NO CONTEXT IS SAVED — BUT IT STALLS FOR THAT CYCLE IF IT NEEDED THE BUS THEN.
DMA transfer modes
CYCLE STEALING TAKES ONE WORD PER BUS ACQUISITION. BURST MODE TRANSFERS A WHOLE BLOCK IN ONE ACQUISITION. TRANSPARENT MODE TRANSFERS ONLY IN CYCLES THE PROCESSOR DOES NOT USE.
CYCLE STEALING SPREADS THE SLOWDOWN THINLY. BURST GIVES THE FASTEST TRANSFER AND THE WORST LATENCY FOR EVERYTHING ELSE. TRANSPARENT IS FREE BUT SLOWEST.
Memory-mapped I/O
DEVICE REGISTERS OCCUPY THE ORDINARY MEMORY ADDRESS SPACE, SO ANY MEMORY INSTRUCTION AND ANY ADDRESSING MODE REACHES THEM.
THE COST IS ADDRESS SPACE: EVERY ADDRESS GIVEN TO A DEVICE IS UNAVAILABLE TO MEMORY, WHICH MATTERS ONLY WHEN THE SPACE IS SMALL.
Isolated I/O
DEVICES OCCUPY A SEPARATE ADDRESS SPACE REACHED BY DEDICATED INSTRUCTIONS, WITH A CONTROL LINE SELECTING THE SPACE.
THE FULL MEMORY SPACE STAYS AVAILABLE AND DEVICE ACCESSES ARE VISIBLY DISTINCT, AT THE COST OF EXTRA INSTRUCTIONS, EXTRA CONTROL LINES AND LOSS OF GENERAL ADDRESSING MODES.
Why device registers are non-cacheable
A CACHE ASSUMES MEMORY CHANGES ONLY WHEN THE PROCESSOR WRITES. A DEVICE REGISTER CHANGES ON ITS OWN, SO A CACHED COPY WOULD HIDE THE CHANGE.
A POLLING LOOP WOULD SPIN FOREVER ON A STALE VALUE, AND UNDER WRITE-BACK A COMMAND WOULD REACH THE DEVICE ONLY ON EVICTION, OR NEVER.
DMA and cache coherence
A DMA CONTROLLER WRITING TO MEMORY BYPASSES THE CACHE, SO A CACHED COPY OF THAT MEMORY BECOMES STALE.
SYSTEMS MUST EITHER INVALIDATE THE AFFECTED LINES OR ROUTE DMA THROUGH A COHERENT PATH. THE HAZARD EXISTS EVEN WITHOUT DEVICE REGISTERS.
Bus arbitration
DAISY CHAIN GIVES FIXED PRIORITY BY POSITION WITH ONE LINE. POLLING MAKES PRIORITY PROGRAMMABLE WITH log2 n LINES. INDEPENDENT REQUEST IS FASTEST AND NEEDS 2n LINES.
THE PATTERN MATCHES INTERRUPT PRIORITY EXACTLY, BECAUSE IT IS THE SAME PROBLEM: SEVERAL REQUESTERS, ONE RESOURCE, WIRING COST AGAINST FLEXIBILITY.
Synchronous versus asynchronous bus
A SYNCHRONOUS BUS TIMES EVERY TRANSFER AGAINST A SHARED CLOCK, SO THE SLOWEST DEVICE SETS THE PACE. AN ASYNCHRONOUS BUS USES A REQUEST-ACKNOWLEDGE HANDSHAKE, SO EACH TRANSFER TAKES EXACTLY AS LONG AS NEEDED.
WAIT STATES ARE THE PRACTICAL COMPROMISE: THE BUS RUNS AT THE FAST PERIOD AND SLOW DEVICES EXTEND THEIR OWN TRANSFERS BY WHOLE PERIODS.
⚠️

Traps GATE sets — and how to dodge them

These are the exact option-traps and misreads that cost marks under negative marking.

WATCH OUT
Describing DMA cycle stealing as interrupting the processor
No context is saved and no routine runs. The controller takes a bus cycle, and the processor stalls only if it needed the bus in that cycle. It is a bus-bandwidth cost, not a processor-time cost.
WATCH OUT
Counting one DMA interrupt per byte transferred
The whole point of DMA is that the controller raises one interrupt when the transfer count reaches zero, so the overhead is per block. A 4 KB block replaces 4096 interrupts with one.
WATCH OUT
Assuming burst-mode DMA is always better because it is faster
It transfers fastest but holds the bus for the whole block, stalling the processor for the duration. It is chosen only when the device cannot tolerate being starved, such as a rotating disk.
WATCH OUT
Treating priority in a daisy chain as configurable
The acknowledge signal passes through devices in physical order, so the first requesting device on the chain wins. Changing priority means physically rewiring, which is exactly what independent requesting avoids.
WATCH OUT
Re-enabling interrupts inside a service routine without a priority check
Nesting is safe only for higher-priority sources. Allowing any interrupt to preempt lets a low-priority device interrupt a high-priority routine, which defeats the priority scheme entirely.
WATCH OUT
Caching a memory-mapped device register
The device changes the register on its own, so a cached read returns a stale value forever and a write-back write may never reach the device. Such regions must be marked non-cacheable.
WATCH OUT
Assuming DMA raises no cache concerns
A DMA write to memory bypasses the cache, leaving any cached copy stale. The system must invalidate the affected lines or route DMA through a coherent path, and this applies to ordinary memory buffers.
WATCH OUT
Claiming memory-mapped I/O needs no special instructions and has no cost
It needs no special instructions, which is the benefit, but every address assigned to a device is removed from the memory space and the region must be marked non-cacheable. Both are real costs.
WATCH OUT
Assuming a synchronous bus is simply faster
Its clock period must accommodate the slowest device, so a fast memory sharing a bus with a slow device is slowed to the device's pace unless wait states are provided.
WATCH OUT
Assuming an asynchronous bus is free of overhead
Every transfer carries the request-acknowledge handshake, which for a fast memory can be comparable to the access itself. This is why synchronous buses with wait states are more common in practice.
WATCH OUT
Comparing polling and interrupts by transfer rate alone
The relevant quantity is device latency, not data rate. An interactive device with a trivially low data rate but a huge latency is the worst possible case for polling, which is why interrupts were introduced for exactly such devices.

Exam-pattern practice

PYQ-style questions with full solutions. Work through them as a readiness check — mark yourself honestly and get your gap report at the end.

Readiness check

Are you exam-ready for I/O Interface: Interrupt & DMA Mode?

9 problems from this chapter. Try each one, reveal the worked solution, mark yourself honestly — get your gap report at the end.

9 questions~6 min

5-minute revision

The whole chapter, distilled. Read this the night before the exam.

  • Two questions: who waits, and who moves the bytes.
  • Programmed I/O has the processor do both.
  • Polling waste equals latency over loop time.
  • Polling is right for always-ready or dedicated systems.
  • Interrupts let the device do the waiting.
  • Interrupts are recognised at instruction boundaries.
  • Interrupt cost is a context save plus a service routine.
  • Non-vectored interrupts poll to identify the source.
  • Vectored interrupts index a table.
  • Daisy chaining fixes priority by position with one line.
  • Independent requesting needs two lines per device.
  • Non-maskable interrupts cannot be disabled.
  • Nest interrupts only for higher priority.
  • DMA is set up by writing address, count and direction.
  • DMA raises one interrupt per block.
  • Per-byte overhead becomes per-block overhead.
  • Cycle stealing takes bus cycles, not instructions.
  • Burst mode is fastest and stalls everything else.
  • Transparent mode is free but slowest.
  • Memory-mapped I/O uses ordinary memory instructions.
  • Memory-mapped I/O costs address space.
  • Isolated I/O uses a separate space and special instructions.
  • Device registers must be non-cacheable.
  • A cached device register hides device changes.
  • DMA writes leave cached copies stale.
  • Daisy chain, polling and independent request also arbitrate buses.
  • A synchronous bus is paced by its slowest device.
  • Wait states let a fast bus accommodate a slow device.
  • An asynchronous bus handshakes on every transfer.

GATE question blueprint

How this topic is asked, tier by tier — so you can prep to the pattern.

Typical weightage: Computer Organization contributes roughly 7-9 of the 72 core-CS marks; I/O supplies 1-2 of those

Question styleMarks eachTypical countWhat it tests
Transfer methods1~1Which method the description matches and who does the waiting and moving
I/O overhead2~1Comparing interrupt-driven and DMA overhead as a percentage of processor time
Cycle stealing2~1Computing bus bandwidth consumed and distinguishing it from processor time
DMA modes1~1Choosing between cycle-stealing, burst and transparent modes
Interrupts1~1Maskability, vectoring and the boundary-recognition rule
Priority resolution2~1Daisy chaining versus independent requesting in lines and flexibility
Cache and I/O2~1The non-cacheable requirement and the DMA coherence hazard
Bus timing2~1Synchronous, wait-state and asynchronous schemes compared

Exam-hall strategy

Battle-tested tips from mentors and toppers for this topic under the sectional clock.

  1. Identify which of the three methods the question describes before computing anything.
  2. Compute interrupt overhead per byte or word, and DMA overhead per block.
  3. Report cycle stealing as bus bandwidth, never as processor time.
  4. For polling questions, work from device latency rather than data rate.
  5. For priority questions, check whether the scheme is positional or programmable.
  6. For cache questions, decide whether the hazard is a device register or a DMA buffer.
  7. DMA overheads and bus utilisation are commonly set as NAT, which carries no negative marking, so never leave one blank.
  8. For 1-mark and 2-mark MCQs, negative marking is -1/3 and -2/3, so guess only after eliminating an option.
  9. GATE gives a single freely-navigable 180-minute window, so flag a long overhead calculation and return to it.

Beyond the exam

Where this skill shows up in the job you're competing for — and in life.

Choosing between polling and interrupts in a driver

Network drivers switch to polled mode under heavy load precisely because the interrupt overhead exceeds the polling cost once packets are always waiting.

Setting up a DMA transfer

Writing an address, a count and a direction into controller registers and then waiting for one completion interrupt is exactly how a disk or network buffer is filled.

Marking a device region non-cacheable

Every operating system's memory-mapping code must flag device registers as uncached, or drivers read stale status forever and commands never reach the hardware.

Flushing buffers around DMA

Invalidating cache lines before reading a DMA-filled buffer and flushing before a DMA read is a standard driver responsibility on non-coherent systems.

Where else this topic is tested

Prepare once, score in every exam that asks it.

GATE ECHigh overlap — interrupt structures, DMA and bus timing are examined in microprocessor and embedded contexts
UGC NET Computer ScienceHigh overlap — the three transfer methods, DMA modes and memory-mapped versus isolated I/O are examined as direct recall
ISRO / BARC / DRDO computer science papersVery high overlap — DMA overhead calculations, priority resolution and bus arbitration are recurring MCQ topics

Questions aspirants ask

Pulled from the Q&A community and mentor sessions.

No, and the distinction is precise enough to be worth stating carefully. An interrupt is a software event: the processor finishes its current instruction, saves the program counter and status flags, disables further interrupts, jumps to a service routine which saves and later restores registers, and eventually returns. The cost is tens to hundreds of cycles of state manipulation, and the processor's instruction stream genuinely diverges. Cycle stealing is a hardware event confined to the bus. The DMA controller asserts a bus request, the processor grants the bus for one cycle, the controller transfers a word, and the bus returns. No state is saved, no routine executes, and the processor's instruction stream is unchanged. The processor stalls only if it happened to need the bus during that cycle, and with a cache it frequently does not. The practical consequence is that the two costs must be computed separately and in different units. Interrupt overhead is measured in processor cycles and appears as a percentage of processor time. Cycle-stealing overhead is measured in bus cycles and appears as a percentage of bus bandwidth. A question asking for the processor overhead of DMA wants the setup and completion cost only, while a question asking for the bus impact wants the stolen cycles. Answering one with the other is a standard error.

When the device is ready so often that the polling loop almost always succeeds on its first or second attempt, so the per-byte cost approaches a handful of instructions rather than an interrupt's hundreds of cycles of context manipulation. The crossover is computed by comparing the expected number of poll iterations per successful transfer against the ratio of interrupt cost to poll cost. With a 400-cycle interrupt and a 15-cycle poll, polling wins once fewer than about 27 checks are needed per transfer. For a device with millisecond latency that condition is hopeless: millions of checks would be needed. For a device with sub-microsecond latency under load it is easily met. This is not a theoretical curiosity. High-performance network drivers switch from interrupt-driven to polled operation when traffic is heavy, precisely because at line rate the next packet is essentially always waiting and the interrupt overhead would dominate. Three other situations favour polling regardless of the arithmetic. An embedded system with nothing else to do loses nothing by spinning. A hard real-time system may prefer polling because its timing is completely deterministic while interrupt latency is not. And a system without interrupt hardware at all has no choice. The general lesson is that the relevant quantity is device latency rather than data rate, which is why interactive devices with trivial data rates were the original motivation for interrupts.

Because a cache is built on an assumption that device registers violate. The cache assumes a memory location changes only when the processor writes to it, so a copy held in the cache stays valid until the processor itself invalidates it. A device register breaks that assumption in both directions. A status register changes when the device changes state, with no processor involvement, so a cached copy silently becomes wrong. A polling loop reading such a register would hit in the cache on every iteration and return the same stale value forever, never observing the device becoming ready. The write direction fails under a write-back cache. A command written to a device register would be recorded in the cache and marked dirty, reaching the device only when the line is evicted, which happens at an unpredictable time and might never happen at all if the line is discarded. Commands would appear to be issued and then not take effect, or take effect long after the program moved on. The fix is to mark the address region non-cacheable so every access goes straight to the device. Isolated I/O sidesteps the whole problem by construction, since device accesses use a separate address space that the cache does not cover, and this is one of the genuine architectural arguments in its favour.

It depends on which cost the system can least afford: sustained processor slowdown, worst-case processor latency, or transfer speed. Cycle stealing takes one bus cycle per word and releases the bus between words, so the processor's slowdown is spread thinly across the transfer. Nothing stalls for long, and the average bus consumption is exactly the transfer rate divided by the bus bandwidth. This is the default because it degrades gracefully. Burst mode holds the bus for an entire block, so the transfer completes as fast as the bus allows, but the processor cannot use the bus for the whole duration and may stall for thousands of cycles. It is chosen when the device cannot tolerate being starved: a disk whose platter keeps rotating past the head, or a communications link with no buffering, must be serviced at its own pace or data is lost. Transparent mode transfers only in cycles the processor leaves idle, so the processor suffers no slowdown whatsoever, but the controller must wait for opportunities and the transfer takes as long as the processor's bus usage permits. It suits systems where the transfer has no deadline and processor performance is paramount, and it becomes more practical on cache-equipped processors, which leave many bus cycles unused. In practice the choice is often made per device, with the same controller supporting several modes.

Because the handshake overhead of a fully asynchronous bus is paid on every single transfer, including the fast ones that dominate the traffic. On an asynchronous bus, each transfer requires the master to assert a request, the slave to respond with an acknowledge, and both to deassert in sequence. That round trip involves signal propagation in both directions and settling time, and for a memory that responds in a few nanoseconds the handshake can cost as much as the access itself. A synchronous bus has no such per-transfer negotiation: both parties know when to sample by counting clock edges, so a transfer costs exactly its clock periods and nothing more. The obvious weakness of a plain synchronous bus is that the clock period must accommodate the slowest device, so a fast memory sharing a bus with a slow peripheral is slowed to the peripheral's pace. Wait states fix exactly this. The bus runs at a period suited to the fast devices, and a slow device asserts a wait line that extends its own transfer by whole clock periods without affecting anyone else's. Fast accesses complete in one period; slow ones take as many as they need. The result has the low overhead of synchronous timing and most of the flexibility of asynchronous timing, with the only cost being the wait mechanism and the requirement that slow devices implement it correctly. That combination is why it became the standard.
Header Logo