Assignment Solution Week10
Assignment Solution Week10
1. Which of the following are not true for DMA data transfer?
a. Data are transferred directly between the memory and the
peripheral without CPU intervention.
b. CPU puts all its memory bus lines in high impedance state before
data transfer can begin.
c. It is more suitable for devices where the data transfer rates can
vary widely.
d. None of the above.
Correct answer is (c).
In DMA transfer, the DMA controller sends a DMA request to the CPU, in
response to which CPU puts all its address, data and control bus lines in
the high impedance states. The DMA controller can then transfer data
directly between device and memory without CPU intervention. Clearly, it
is more suitable for devices with high data transfer rates like disk.
2. Programmed I/O is not suitable for high-speed data transfer because:
a. For transfer of every word between I/O device and memory, a set
of machine instructions has to be executed.
b. It does not support synchronous mode of data transmission that is
a requirement for many high-speed peripherals like disk.
c. Lot of CPU time is wasted.
d. None of the above.
Correct answers are (a) and (b).
In programmed I/O, CPU executes a program that is responsible for the
data transfer. The CPU cannot do anything else during the period of data
transfer. Since program execution takes time, this mode is more suitable
for devices with low to moderate data rates. In particular, it is not suitable
for high speed devices like disk which transfers data continuously
(synchronously) when the read/write head is on the correct track.
3. Suppose that a disk is rotating at a speed of 10,000 rpm, and there are
120 Kbytes of data recorded in every track. Once the disk head reaches
the desired track, the sustained data transfer rate will be ………………
Mbytes/sec.
Correct answer is 20.
In a 10,000 rpm disk, one complete revolution takes 6 milliseconds.
So, 6 msec time is required to transfer 120 Kbytes
Thus, 1 sec time is required to transfer 120/6 Mbytes = 20 Mbytes.
4. On a non-pipelined sequential processor, the following program segment,
that is part of the Interrupt Service Routine (ISR), is given to transfer 500
bytes from an I/O device to memory.
Initialize the memory address register
Initialize word count register to 500
Loop: Load a byte from device
Store in memory at address given by address register
Increment the memory address register
Decrement the word count register
If count != 0 goto Loop
Assume that each statement in the program is equivalent to a machine
instruction that takes 1 clock cycle to execute if it is a non-LOAD/STORE
instruction. The LOAD/STORE instructions take 2 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. Eack DMA
transfer cycle takes 2 clock cycles to transfer one byte of data from the
device to the memory.
The approximate speedup when the DMA controller based design is used
in place of the interrupt driven approach is ………………….
Correct answer is 3.43.
In alternative 1, total number of clock cycles required
= 1 + 1 + 500 (2 + 2 + 1 + 1 + 1) = 3502
In alternative 2, total number of clock cycles required
= 20 + 500 x 2 = 1020
Speedup = 3502 / 1020 = 3.43
5. The size of the word count register of a DMA controller is 16 bits. The
processor needs to transfer a file of 29,154 Kbytes from disk to main
memory. The memory is byte addressable. The minimum number of times
the DMA controller needs to get control of the system bus from the
processor to transfer the file from disk to main memory is ………………
Assume 1K = 1024.
Correct answer is 455.5.
Maximum number that can be stored in 16 bits is 216 – 1 = 65535 = 64K
(approx.)
So, up to 64K bytes of data can be transferred by the DMA controller at a
time.
Number of times DMA controller needs to be invoked
= 29154 / 64 = 455.5