# How to find percentage of CPU time consumed during DMA operation?

Q) Consider 1MBps hard-disk is interfaced to the processor in a cycle stealing mode of DMA whenever $$64$$ bytes of data is available in the buffer,then it is transferred to main memory (1 word = 64 bits) and machine cycle time is 2 micro sec. Then,

1.) Percentage of CPU time consumed for DMA operation is ?
2.) Percentage of CPU time consumed for DMA Operation if burst mode is used?

Given Solution :
1.) For Cycle Stealing Mode
1 word = 64 bits = 8 bytes is transferred in one cycle.
Since total 64 bytes is to be transferred So total number of cycles $$= 64/8 =8$$,
1 cycle time = 2µs , So time for 8 cycles is = 16µs
Now time taken by disc to transfer 64 B is $$(64)/10^{6}=64µs$$
Hence % of CPU Time consumed = Data Preparation Time / Data Transfer time $$= (16 / 64)*100\% = 25\%$$
My Doubt : How does the above formulae give the % time consumed by CPU or basically where CPU spends time during a DMA transfer and why are we dividing by the disk transfer time.

2.) For Burst Mode : Since all data is transferred at once so only 1 cycle is needed for data transfer i.e. 2 µs So % CPU time consumed = Data Preparation Time / Data transfer Time
=$$(2/(2+64))*100\%$$ =~ $$3\%$$
My Doubt : Why are we adding the 2 in burst mode.

• My knowledge of these topics is only marginal at best, but I would say the 2 is probably just the CPU cycle time. – dkaeae Dec 27 '18 at 10:32
• Yes that is already mentioned in the question. – Sourajit Dec 27 '18 at 12:15