GATE / CS ARCHIVE

GATE CSE 2011 / QUESTION 28

DMA versus programmed interrupt transfer

Computer Organization & Architecture · Input/Output, DMA & Interrupts · Full GATE CSE 2011 paper

GATE 2011, Q28 2 marks · MCQ
Report issue

Input/Output, DMA & Interrupts

Question 28, GATE 2011: On a non-pipelined sequential processor, transferring 500 bytes uses this interrupt-service program: initialize address register; initialize count=500; LOOP: load one byte from device; store it to the address register's memory location; increment address register; decrement count; if count != 0 go to LOOP. Each load/store takes 2 cycles and every other statement takes 1 cycle. DMA instead needs 20 cycles for initialization/overheads and 2 cycles per byte. What is the approximate DMA speedup over the program?

(A) 3.4
(B) 4.4
(C) 5.1
(D) 6.7
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The two initializations take 2 cycles. Each of 500 loop iterations uses 2 cycles for load, 2 for store and 1 each for increment, decrement and branch, totaling 7. Programmed transfer costs 3502 cycles. DMA costs 20+500×2=1020 cycles. Speedup3502/1020≈3.433, closest to 3.4, A.

Count the conditional branch even on its last, untaken execution: testing the condition is still an instruction. The loop therefore executes 500 loads, 500 stores and 1500 one-cycle bookkeeping instructions, in addition to the two initializations. DMA removes per-byte CPU loop bookkeeping but still pays its transfer cycles and setup. Speedup is old elapsed cycles divided by new elapsed cycles, not the reverse and not the difference between the two counts.

Original paper, page 8 · Answer key