March 3, 2012

The fraction of CPU time handling the data transfer with and without DMA

The fraction of CPU time handling the data transfer with and without DMA

Query:

An I/O device transfers data at a rate of 5MB/s over a 100MB/s bus. The data is transferred in 2KB blocks. If the processor operates at 500MHz, and it takes a total of 5000 cycles to handle each DMA request, find the fraction of CPU time handling the data transfer with and without DMA

Solution:

Without DMA
The processor here copies the data into memory as it is sent over the bus. Since
the I/O device sends data at a rate of 10MB/s over the 100MB/s bus, 5 % of each second
is spent transferring data. Thus 5% of the CPU time is spent copying data to memory.

With DMA
Time required in handling each DMA request is 5000 cycles. Since 500 DMA requests are issued (10MB/2KB) the total time taken is 25, 000, 00 cycles. As the CPU
clock is 500MHZ, the fraction of CPU time spent is 25,000,00/(5000×106) or 5%.

Last updated: March 19, 2014