7,674 views
A hard disk is connected to a $50$ MHz processor through a DMA controller.  Assume that the initial set-up of a DMA transfer takes $1000$ clock cycles for the processor, and assume that the handling of the interrupt at DMA completion requires $500$ clock cycles for the processor. The hard disk has a transfer rate of $2000$ Kbytes/sec and average block transferred is $4$ K bytes.  What fraction of the processor time is consumed by the disk, if the disk is actively transferring $100\%$ of the time?

Just 1 doubt here. When its asked in the question about fraction of processor time consumed by the disk, then why are we considering the DMA time in the numerator ?

If question mentions nothing about which mode we should use, then by default we consider Burst mode.

Moreover, if question mentions, "constantly transferring data to memory using DMA or the disk is actively transferring 100% of the time ”, then also we need to consider Burst Mode.

$2000$ $KB$ is transferred in $1$ second

$4$ $KB$ transfer is $(4/2000 ) * 1000 \text{ ms} = 2 \text{ ms}$

Total cycle required for locking and handling of interrupts after DMA transfer control

$=(1000+500) \text{ clock cycle } = 1500 \text{ clock cycle }$

Now, $50$ $Mhz = 50 * 10^6 = 0.02 \text{ microsecond}$

So, $(1500 * 0.02 ) = 30 \text{ microsecond}$

$30 \mu s$ for initialization and termination and $\ 2 ms$ for data transfer.

The CPU time is consumed only for initialization and termination.

Fraction of CPU time consumed $=\dfrac{30\mu s}{(30\mu s+2\,ms)}=0.015$

yes correct abhilash

it is  fraction of the processor time is consumed by the disk

It literally depends on what words you focus first on
According to me what i figure out is

No of cycle (ticks ) by a processor = 50MHhz= 50 Million = 50 *10^6 cycle in 1 second

The time taken by 1 cycle take 0.2 μsecond

Total cycle required for locking and hadnling of interrupt after DMA transfer control=(1000+500) clock cyle = 1500 clock cycle= (1500*0.2  μsecond) = 300 μsecond

Since 2000K bytes is send in 60*10^3 msec

therefore 4K bytes can be send in (4*60*10^3)/2000= 120msec

Now as i know in 10^3 m sec = 50*10^6 cycles happen

therfore in 120 msec  , no of cycle that will happen is 6*10^6 cycle.

Now since each cycle take 0.2  μsecond

therefore 6*10^6 cycle will take 1.2 second

therfore fraction of cpu time consumed by disk = 300  μsecond / (300  μsecond + 120msec)=2.49 msec

30 us for initialisation and termination and 2 ms for data transfer% of cpu time consumed =30us/(30us+2ms)*100=1.5%
conver 2 milliseconds to microsecond dear  2ms=2000 us...so--> (30/2030)*100=1.47%
@Arjun sir why isnt this the case –

2000MBps here M is 10^6

4KB here K should be 2^10?? Isnt it? Why here 10^3 taken for K?
(30/30+2000)*100  = 1.4778%

using DMA for data transfer from a hard disk.
initial DMA setup = 1000 cycles
Interrupt handling on DMA completion = 500 cycles
Average size of data transfer = 4 KB
Each DMA transfer takes (4 KB)/(2000 KB/sec) = 2 X 10-3 seconds
CPU cycles used for DMA transfer = 1000 + 500 = 1500
Total CPU cycles during DMA transfer = (50 X 106) X (2 X 10-3)
= 100 X 103
Fraction of CPU cycles used for DMA = 1500 / 100 X 103
= 1.5 %

by