444 views
A hard disk is connected to a $2$ GHz processor through a DMA controller which works in burst mode. The initial set up of a DMA transfer takes $1000$ clock cycles for the processor and DMA completion requires $700$ clock cycles.

The hard disk has a transfer rate of $4000$ KB / sec and the average block size transferred is $16$ KB. Then, the fraction of CPU time free if the disk is transferring data is  _______%.

Can you tell me how you got 99.91% and 99.78 % ? , you can see my solution, i got 97.87 % .
yes, i got the answer, cpu time is full means cpu is utilizing for 100%, so % of processor time involved is 0.02124%

and % of cpu time free is (100-0.02124) = 99.978 %
edited by
for initial setup for dma and dma completion it requires total 1000 + 700 equals to 1700 cycles

nw 1700 * (1\(2*10^(9)) equals to .850 MICROSECOND

nw transfer rate of hard disk given to be 4000kB in  1 second

THEREFORE 16KB CAN BE TRANSFERED IN 16KB\4000KB 4000MICROSECOND

NW PERCENTAGE OF CPU TIME FREE WOULD BE  (((4000))\(4000.850))*100

Total cycle required for initial set up of a DMA transfer and DMA completion

= (1000 + 700 ) clock cycles

=1700 clock cycles

Given clock rate= 2 GHz. So, clock cycle time=(1/clock rate)= (1/2 GHz) = (1/ 2*109 ) * 109 ns = 0.5 ns

No of cycles for Initialization and Completion of the block transfer is 1700 cycles,

so total time takes by processor =1700*0.5 ns=850 ns . let X = 850 ns , this is preparation time or total clock cycle time use by cpu .

Disk transfer rate is 4000 KB/sec. So, to transfer 16 KB, the time required is ( 16/4000 ) sec=4000000 ns.

Let  Y= 40,00000 ns , this is transfer time.

% of time processor "involved" is = X/(X+Y) * 100

= {850/(850+4000000)} * 100 [ as question explicitly says it is burst mode, so we use this formula x/x+y where x =clock cycle time use by cpu   and y = Transfer time ]
=0.02124 %

[ In burst mode all data is transferred in a single cycle . so we need to consider x+y in this formula x/x+y ]

Therefore, % of processor time is free= 100 - % of processor time involved
=(100- 0.02124)

=99.97876

=99.978

by

reshown by

But it is not mentioned that disk is actively transferring the data.

So why are we assuming that after every 4 ms it will consume CPU time.The reference https://gateoverflow.in/1062/gate2004-68?show=27837#a27837 is given that disk is sending data constantly but the question in context it should be one time only

so answer must be CPU time taken/(CPUtime taken+Time to send data at device speed)

Please correct me sir,if i am getting it wrong

yes @rahul

you are correct , answer must be CPU time taken/(CPUtime taken+Time to send data at device speed)

or total cycle time by cpu / ( cpu cycle time + transfer time )

but can u tell me how u got 99.97% ? i am getting 97.87 %

and in this question https://gateoverflow.in/1062/gate2004-68?show=27837#a27837 burst mode is used, see the formula used is x/x+y

DMA initiation (taking the bus control) = $1000 cc = 500ns$

DMA completion (handling the bus control back) = $700 cc = 350 ns$

Time required for transferring a block of 16KB with 4000 KB/s speed = $16/4000=0.004seconds$

CPU time consumed would be just for setting up and handling the DMA = $500ns + 350ns = 850ns$

Total time would be = $850ns + 0.004s = 0.004s$ (approx)

So, CPU time consumed = $850ns/0.004s = 0.02\%$

=> %CPU time not consumed = $100-0.02=99.8\%$ (approx)