Sub topic 9
Burst, cycle stealing and transparent DMA
This chapter assumes you know the DMA controller's registers and the bus request and grant handshake from the previous chapter. It also assumes you can do basic rate arithmetic. Here we look at how a DMA controller shares the system bus with the CPU while a block moves. The three standard answers are burst mode, cycle stealing and transparent mode. GATE questions often ask which mode gives the highest transfer rate, which one slows the CPU the least, and how much CPU time each costs.
The problem: one bus, two masters
The CPU and the DMA controller both need the system bus. The bus carries the address, data and control lines to memory and to I/O. Only one master can drive it at a time. The DMA controller asks for the bus with a bus request signal (often called HOLD or BR). The CPU answers with a bus grant signal (HLDA or BG) when it has released the bus.
The modes differ in one decision: how long the controller keeps the bus once it has been granted.
| Mode | Bus held for | Effect on the CPU | Effect on the transfer |
|---|---|---|---|
| Burst (block) | The whole block, or until the device runs dry | CPU is frozen for the whole block | Fastest |
| Cycle stealing | One bus cycle per word, then released | CPU is slowed by one cycle per word | Slower, spread out |
| Transparent (hidden) | Only cycles the CPU is not using the bus | No slowdown | Slowest and least predictable |
A bus cycle is one memory or I/O access on the bus. A DMA transfer moves one word per bus cycle, so a block of N words needs N bus cycles of DMA work.
Burst mode
In burst mode (also called block mode), the controller requests the bus once. It keeps the bus until the whole block has moved, then releases it.
- The device signals that it has data ready.
- The controller asserts bus request.
- The CPU finishes its current bus cycle and asserts bus grant.
- The controller transfers all N words, one per bus cycle, incrementing the address register and decrementing the word count each time.
- When the count reaches zero, the controller releases the bus and raises an interrupt.
The CPU can still run internal work while it waits, for example instructions that use only registers or a cache. It stalls the moment it needs the bus. For a long block that is a long stall.
Burst mode suits fast devices such as disks. A disk needs its data at a fixed moment. If the data is not taken in time, it is lost, and the disk must spend another rotation. Burst mode also pays the request and grant overhead once for the whole block.
The costs are CPU stalls and latency for other devices. Interrupts and other DMA channels must wait for the bus until the burst ends.
Cycle stealing
In cycle stealing mode, the controller takes the bus for a single bus cycle, moves one word, and gives the bus back. The CPU loses ("has a cycle stolen") once for each word moved.
The controller does this every time the device has another word ready. A slow device produces words rarely, so the CPU loses a cycle only now and then. A fast device steals many cycles.
The CPU is never frozen for long, since each theft lasts one bus cycle. This is the usual choice for devices with moderate data rates, and for systems where the CPU must remain responsive. The cost is that each word pays the bus request and grant overhead again. The total transfer takes longer than in burst mode.
A standard GATE-style reading: the CPU is not stopped for the whole block, only for the cycles that DMA uses. If the DMA takes one cycle out of every k, the CPU runs at roughly (k − 1)/k of its speed during the transfer, assuming it needs the bus in every cycle.
Transparent DMA
In transparent mode (also called hidden mode), the controller uses the bus only in cycles where the CPU is not using it. The CPU never waits for DMA, so the transfer is "transparent" to the program.
Transparent mode needs hardware that can tell when the CPU is not using the bus. This happens during certain phases of the instruction cycle, such as the decode phase or an internal ALU operation, when no memory access is made. With a cache that satisfies most CPU accesses, the system bus is often idle too.
The strengths:
- The CPU is not slowed at all by the transfer.
- No bus request and grant stall is imposed on the CPU.
The weaknesses:
- The transfer rate depends on what the CPU is doing. A program that uses the bus constantly leaves few free cycles, so DMA crawls.
- The controller needs extra logic to detect idle bus cycles.
- It is not suitable for devices that must be served by a deadline.
Comparing the modes with a timeline
The diagram shows the bus ownership for a four-word block under the two modes that differ most. In burst mode, DMA owns the bus for four consecutive cycles. In cycle stealing mode, DMA takes one cycle at a time between CPU cycles.
Each day on the axis stands for one bus cycle. Highlighted bars are DMA cycles. Both rows move four words. The burst row finishes the DMA work sooner, but the CPU has one long gap. The cycle stealing row spreads the same work across many small gaps.
What the CPU actually loses
The CPU's loss depends on the mode. Take a block of N words on a system where each bus cycle takes t seconds, and assume the CPU would otherwise use the bus in every cycle.
- Burst mode: the CPU is blocked for N × t, plus the one-time request and grant overhead.
- Cycle stealing: the CPU is delayed by N × t in total as well, but in N pieces of length t. Each piece also carries request and grant overhead, so the total delay is somewhat larger.
- Transparent: the delay is zero, but the transfer may take far longer than N × t in real time.
The total CPU time lost is similar for burst and cycle stealing. The difference is how it is distributed. Burst gives the CPU one long stall. Cycle stealing gives many short ones. That distinction matters for real-time response, because an interrupt arriving mid-burst must wait for the burst to finish.
A worked calculation
A DMA controller moves data between a device and memory. The memory bus cycle is 100 ns. A block has 1000 words, and one word moves per bus cycle. The CPU would otherwise use the bus in every cycle.
Burst mode. The transfer takes 1000 × 100 ns = 100 µs. The CPU is blocked for those 100 µs, ignoring the single request and grant exchange.
Cycle stealing. Suppose the device produces one word every 1 µs, which is 10 bus cycles. The controller steals 1 cycle in every 10. The CPU loses 1 of every 10 cycles, which is 10% of its bus time. The block takes 1000 × 1 µs = 1 ms, much longer than the burst, but the CPU runs at about 90% speed throughout.
You can check this with a short script.
def burst(words, cycle_ns):
transfer_us = words * cycle_ns / 1000
cpu_blocked_us = transfer_us # CPU frozen for the whole block
return transfer_us, cpu_blocked_us
def cycle_steal(words, cycle_ns, word_interval_ns):
transfer_us = words * word_interval_ns / 1000
stolen_us = words * cycle_ns / 1000 # total bus time taken from the CPU
stolen_fraction = cycle_ns / word_interval_ns
return transfer_us, stolen_us, stolen_fraction
t, blocked = burst(1000, 100)
print(f"Burst: transfer {t:.0f} us, CPU blocked {blocked:.0f} us")
t, stolen, frac = cycle_steal(1000, 100, 1000)
print(f"Cycle stealing: transfer {t:.0f} us, CPU loses {stolen:.0f} us ({frac:.0%} of bus time)")Running it prints:
Burst: transfer 100 us, CPU blocked 100 us
Cycle stealing: transfer 1000 us, CPU loses 100 us (10% of bus time)Both modes take 100 µs of bus time from the CPU. Burst takes it in one lump and finishes in 100 µs. Cycle stealing takes it in 1000 pieces over 1000 µs.
Choosing a mode
The choice follows from the device and the system's needs.
| Situation | Better mode | Reason |
|---|---|---|
| Fast device that cannot wait (disk, high-speed network) | Burst | Data must be moved at the device's rate |
| Moderate device, CPU must stay responsive | Cycle stealing | Short, bounded stalls |
| Slow device, CPU is busy and idle bus cycles are common | Transparent | No CPU slowdown at all |
| Real-time system with strict interrupt latency | Cycle stealing or transparent | A long burst delays interrupts |
Common errors
- Saying the CPU stops completely during DMA. In burst mode it stops using the bus, but it may continue internal work. In cycle stealing and transparent modes it keeps running.
- Saying cycle stealing is faster than burst mode. For a given block it is slower. Its advantage is lower CPU disruption per moment, not speed.
- Saying transparent mode costs the CPU nothing in every respect. The CPU is not delayed, but the transfer is slow and unpredictable, and it needs extra hardware.
- Forgetting that a DMA word still costs a bus cycle. Even in transparent mode, the bus is being used. It is just a cycle the CPU did not want.
- Confusing the DMA mode with the DMA device mode. These are modes of bus sharing with the CPU. A controller can also be described by how it serves several devices, which is a separate question.
GATE-style patterns
Three patterns recur.
- Time the CPU is blocked. For burst mode, blocked time is (words) × (bus cycle time). Add the request and grant overhead if the question gives it.
- Fraction of cycles stolen. For cycle stealing, divide the DMA cycle time by the interval between words. With a 100 ns cycle and a word every 1 µs, the fraction is 0.1.
- Which mode fits. Match the keyword. "Highest transfer rate" or "block" means burst. "One word at a time, CPU slowed slightly" means cycle stealing. "No effect on the CPU" means transparent.
Exercise
A DMA controller transfers a 2000-word block in cycle stealing mode. The bus cycle is 50 ns and the device delivers one word every 500 ns. Find the total transfer time, the total time the CPU loses, and the fraction of bus cycles stolen. Then state how long the CPU would be blocked if the same block moved in burst mode.
Show answer
Transfer time = 2000 × 500 ns = 1000 µs = 1 ms. CPU time lost = 2000 × 50 ns = 100 µs. Fraction stolen = 50 / 500 = 10%. In burst mode the CPU would be blocked for 2000 × 50 ns = 100 µs, and the transfer would finish in 100 µs if the device could supply data that fast.
Exercise
A system runs a program that accesses memory in every bus cycle. A DMA controller in transparent mode tries to move a block. What happens to the transfer, and why is transparent mode a poor choice here?
Show answer
The CPU leaves no idle bus cycles, so the controller almost never finds a free cycle and the transfer stalls or proceeds extremely slowly. Transparent mode relies on the CPU leaving the bus idle, so it only works well when the CPU's bus usage is low.
Exercise
Name the mode that suits each case: (a) a disk that loses data if not served at once, (b) a real-time controller whose interrupts must be handled within a few bus cycles, (c) a processor with a large cache and a slow device.
Show answer
(a) Burst mode, because the data must be moved at the device's rate. (b) Cycle stealing, because each stall is one bus cycle at most. (c) Transparent mode, because the cache leaves many idle bus cycles and the device is slow.