IO Interface · Computer Organization and Architecture
14 questions · asked in 10 of 27 years (2000–2026)
MCQ 12 · NAT 21-mark 11 · 2-mark 3
2000Questions per year2026
Questions 6–10 of 14
On a non-pipelined sequential processor, a program segment, which is a part of the interrupt service routine, is given to transfer 500 bytes from an I/O device to memory.
Initialize the address register
Initialize the count to 500
LOOP: Load a byte from device
Store in memory at address given by address register
Increment the address register
Decrement the count
If count != 0 go to LOOP
Assume that each statement in this program is equivalent to a machine instruction which takes one clock cycle to execute if it is a non-load/store instruction. The load-store instructions take two clock cycles to execute.
The designer of the system also has an alternate approach of using the DMA controller to implement the same transfer. The DMA controller requires 20 clock cycles for initialization and other overheads. Each DMA transfer cycle takes two clock cycles to transfer one byte of data from the device to the memory.
What is the approximate speedup when the DMA controller based design is used in place of the interrupt driven program based input-output?
Initialize the address register
Initialize the count to 500
LOOP: Load a byte from device
Store in memory at address given by address register
Increment the address register
Decrement the count
If count != 0 go to LOOP
Assume that each statement in this program is equivalent to a machine instruction which takes one clock cycle to execute if it is a non-load/store instruction. The load-store instructions take two clock cycles to execute.
The designer of the system also has an alternate approach of using the DMA controller to implement the same transfer. The DMA controller requires 20 clock cycles for initialization and other overheads. Each DMA transfer cycle takes two clock cycles to transfer one byte of data from the device to the memory.
What is the approximate speedup when the DMA controller based design is used in place of the interrupt driven program based input-output?
Answer: (A)
Program-driven I/O: one byte takes load (2) + store (2) + increment (1) + decrement (1) + branch (1), which is 7 cycles.
Total for 500 bytes: 500 7 + 2 (initialisation) = 3502 cycles
DMA: 20 + 500 2 = 1020 cycles
Speed-up = 3502 / 1020 3.4
Answer: 3.4
Total for 500 bytes: 500 7 + 2 (initialisation) = 3502 cycles
DMA: 20 + 500 2 = 1020 cycles
Speed-up = 3502 / 1020 3.4
Answer: 3.4
Which of the following statements about synchronous and asynchronous I/O is NOT true?
Answer: (A)
In both synchronous and asynchronous I/O, the device raises an interrupt when the transfer finishes, and an ISR runs. The two differ only in what the calling process does.
(B) is true: an ISR is invoked on completion in both cases.
(C) is true: a synchronous call blocks the process until the I/O is done; an asynchronous call returns at once.
(D) is true: in synchronous I/O the ISR wakes the blocked process.
(A) is false: it says no ISR is invoked in asynchronous I/O. The ISR still runs; it then notifies the process (by a signal or callback) instead of waking a blocked one.
Answer: (A)
(B) is true: an ISR is invoked on completion in both cases.
(C) is true: a synchronous call blocks the process until the I/O is done; an asynchronous call returns at once.
(D) is true: in synchronous I/O the ISR wakes the blocked process.
(A) is false: it says no ISR is invoked in asynchronous I/O. The ISR still runs; it then notifies the process (by a signal or callback) instead of waking a blocked one.
Answer: (A)
Which of the following DMA transfer modes and interrupt handling mechanisms will enable the highest I/O band-width?
Answer: (C)
I/O bandwidth depends on how long the DMA can keep the bus (the DMA mode) and how fast the CPU reacts to the device (the interrupt method).
DMA mode:
- Transparent DMA uses the bus only when the CPU is not using it. The CPU is never slowed, but the device must wait for free bus time, so the I/O rate is low. This makes (A) wrong.
- In cycle stealing the device moves one word, gives the bus back, and gets it again only after a few CPU cycles. So the I/O rate is limited. This makes (B) wrong.
- In block (burst) transfer the DMA holds the bus and sends a whole block in one go. This gives the highest I/O bandwidth.
Interrupt handling: with polling the CPU has to check the devices one by one to find which one needs service, which is slow. With vectored interrupts the device supplies the address of its own service routine, so service starts at once. This makes (D) wrong.
Block transfer with vectored interrupts is the best on both counts.
Answer: (C)
DMA mode:
- Transparent DMA uses the bus only when the CPU is not using it. The CPU is never slowed, but the device must wait for free bus time, so the I/O rate is low. This makes (A) wrong.
- In cycle stealing the device moves one word, gives the bus back, and gets it again only after a few CPU cycles. So the I/O rate is limited. This makes (B) wrong.
- In block (burst) transfer the DMA holds the bus and sends a whole block in one go. This gives the highest I/O bandwidth.
Interrupt handling: with polling the CPU has to check the devices one by one to find which one needs service, which is slow. With vectored interrupts the device supplies the address of its own service routine, so service starts at once. This makes (D) wrong.
Block transfer with vectored interrupts is the best on both counts.
Answer: (C)
Consider a disk drive with the following specifications:
16 surfaces, 512 tracks/surface, 512 sectors/track, 1 KB/sector, rotation speed 3000 rpm. The disk is operated in cycle stealing mode whereby whenever one 4 byte word is ready it is sent to memory; similarly, for writing, the disk interface reads a 4 byte word from the memory in each DMA cycle. Memory cycle time is 40 nsec. The maximum percentage of time that the CPU gets blocked during DMA operation is:
Answer: (B)
Only one surface is read or written at a time, and one rotation reads one track.
Data per track = . Rotation speed = 3000 rpm = 50 rotations per second.
Transfer rate = .
Time for one 4-byte word = .
In cycle stealing, DMA takes one memory cycle () for each word. The CPU is blocked only if it needs memory at that moment. The maximum blocking happens when the CPU needs memory all the time, so the percentage of time blocked equals the share of memory cycles DMA uses.
A word is ready every 152.6 ns, which is about memory cycles. Taking whole cycles, DMA uses 1 cycle in every 4.
Maximum blocked time = . (The exact share is , and 25 is the closest option.)
Answer: (B)
Data per track = . Rotation speed = 3000 rpm = 50 rotations per second.
Transfer rate = .
Time for one 4-byte word = .
In cycle stealing, DMA takes one memory cycle () for each word. The CPU is blocked only if it needs memory at that moment. The maximum blocking happens when the CPU needs memory all the time, so the percentage of time blocked equals the share of memory cycles DMA uses.
A word is ready every 152.6 ns, which is about memory cycles. Taking whole cycles, DMA uses 1 cycle in every 4.
Maximum blocked time = . (The exact share is , and 25 is the closest option.)
Answer: (B)
A device with data transfer rate 10 KB/sec is connected to a CPU. Data is transferred byte-wise. Let
the interrupt overhead be 4 sec. The byte transfer time between the device interfaces register and
CPU or memory is negligible. What is the minimum performance gain of operating the device under
interrupt mode over operating it under program-controlled mode?
Answer: (B)
In programmed I/O, the CPU sends a command and then waits until the I/O work is done.
So here, the CPU waits for to move of data.
The minimum gain in interrupt mode comes with the smallest unit of data moved. Here that is byte.
Time to move byte in programmed I/O mode:
In interrupt mode, to move byte, the overhead is
Performance gain:
So, (b) is the correct answer.
So here, the CPU waits for to move of data.
The minimum gain in interrupt mode comes with the smallest unit of data moved. Here that is byte.
Time to move byte in programmed I/O mode:
In interrupt mode, to move byte, the overhead is
Performance gain:
So, (b) is the correct answer.
Keep practising