4.2k views

A hard disk with a transfer rate of 10 Mbytes/second is constantly transferring data to memory using DMA. The processor runs at 600 MHz, and takes 300 and 900 clock cycles to initiate and complete DMA transfer respectively. If the size of the transfer is 20 Kbytes, what is the percentage of processor time consumed for the transfer operation?

1. 5.0%
2. 1.0%
3. 0.5%
4. 0.1%
retagged | 4.2k views
0
They should've written the question as "percentage of processor time consumed in the total transfer operation?" Their wording is a bit difficult to understand.

Clock cycle time = $\frac{1}{600}\times10^6$   [ Frequency = 1/Time]

For DMA initiation and completion = $\frac{(900+300)}{600\times10^6}$  = 2 microsec .

Disk Transfer rate = 10 Mbytes/sec

1 byte = $\frac{1}{10^7}$ sec

20 Kbytes = 2 milisec = 2000 micro sec

Percentage = $\left (\frac{2}{2+2000} \right )\times100$    =0.0999 ≃ $0.1$%

option D

% of cpu time consume= x/x+y

Now, when , x= Data preparation time or Total cycle time use by CPU   and y=  Data transfer time

To calculate the fraction of CPU time to the data transfer time -  we use (x/x+y) as it is burst mode .
edited
0
@Anirudh Sir...Hard disk is given in the question so We are using burst mode of transfer...If keyboard or printer would be given then we have to use cycle stealing mode.

Is is right?
–1
Y arent we taking MB as 2^20 and instead taking it as 10^6 ?

@Arjun sir

@habibkhan ?
+1
Please correct the above answer at % of CPU time consume =(2/2002)*100 not (2/200)+2*100..
0
DURING DATA STORING 2^20
and during transfering the data 10^6
0

Only % of processor time consumed for transfer operation.

Then why is DMA initialization also considered in transfer operation?

In a way this whole process can be called transfer operation. Thing is in initialization CPU is busy in initialization. During data preparation time CPU is busy doing other usefull task. And during transfer CPU is idle. So what times will be taken to say as processor time consumed in transfer operation??

is this like the duration when CPU is engaged in transfer operation will be considered?

0
transfer takes 2000 and intialization 2units.

then percentage of transfer should be 2000/(2+2000) ??

what is wrong??
0
Why burst mode is used here.Anyone please tell
+2

@rahul

Here burst mode is used because of this line " constantly transferring data to memory using DMA " .

Because in cycle stealing mode , instead of the data being transferred all at once, it is transferred one byte at a time. so we can easily guess here Burst mode can be used .

0
0

I think the following wording is making it Burst mode

If the size of the transfer is 20 Kbytes

Because in cycle stealing transfer is one byte.

@Bikram Sir:- And question may say like:- "Hard disk is actively transferring data in cycle stealing mode", ?

+2
@rahul

They say size of data which is transfer is 20 KB , it does not say 20 KB at one time they can send or divided by multiple times transfer so by seeing the word "constantly " means without a break , i am sure it is burst mode used here ..
+2
@Bikram sir,in DMA while Disk is reading/writing memory, during this time CPU may perform some internal work but not the BUS related activity unlike the interupt driven IO where CPU does not perform any internal work too.In DMA,CPU only intiate the transfer and control it.But here explicitly given that CPU takes 900 clock cycles to complete the transfer.Does it mean here that CPU is ideal during whole transfer like Interrupt driven.
+4

In this question, it is explicitly mention that " The processor takes 900 clock cycles to complete DMA transfer " .

CPU is usually the master and in this DMA case, instead of this master, another master DMA takes its place. So you can see that CPU is also a processor, DMA controller is also a processor but then DMA controller is a special purpose processor meant only for data transfer, nothing else.

CPU is kept in suspended animation and it is going to wait until the DMA controller releases , until the block of data transfer is over, the CPU will be kept in suspended animation and at the end of the block transfer the controller will release the bus to the CPU.

So it means CPU is idle theoritacally in this time period when DMA transfer the data but practically CPU is not idle , it is doing some other task through other bus .. but for our convenience we just think that CPU is siting idle in this time period .

+1

Clock cycle time = 1/600×106

Although it doesn't affect the answer, shouldn't it be 1/(600 x 106) sec or 1/600 x 10-6 sec?

Must be a typo.

0

@Bikram sir

So it means CPU is idle theoritacally in this time period when DMA transfer the data but practically CPU is not idle , it is doing some other task through other bus .. but for our convenience we just think that CPU is siting idle in this time period .

But, isn't we have just one bus in the system? So,how cpu is using some other bus?

0
I think, There will be only one bus, but in case of DMA, the bus is connected from cpu to memory and DMA controller to memory. so while DMA transfering data through bus, the CPU can perform computations other the accessing the bus. so cpu is not idle

Clock cycle time = (1/600) x 10 ^6

For DMA initiation and competion = (900+300)/(600 x 10 ^6) = 2 microsec .

Disk Transfer rate = 10 M bytes. 1 byte = 1/10^7 sec

20 K bytes = 2000 microsec Percentage = (2/2000)*100 =0.1%

so, ans D

.

0
How is it 2/2000 ??
It is simple logical question. No need of so many calculations.
(20KB/10MB)x100
= (20KB/10x1024KB)x100
= 0.1%

The reason for this is whatever may be the processor speed and clock cycle . While taking percentage ratio they will get cancel led out.

Processor Speed = 600MHZ = $6*10^{8}$ cycles/second

Transfer time =   $\frac{20KB}{10MB}$ = 2ms = $12*10^{5}$ cycles

Total cycles consumed = 1200,000 + 300 + 900 = 120,1200 cycles
% of processor time consumed =  $\frac{120,1200*100}{6*10^{8}} = \frac{12012}{60000}$= 0.2%

So, (D) can be chosen as option!

edited
0
@manu00x

how you are getting 0.2?

i am getting 0.1022 %(approx)
0
how?? what will be 12012/60000 = ?
+1 vote

Transfer rate=10 MB per second

Data=20 KB=20* 2 10

So Time=(20 * 2 10)/(10 * 2 20)= 2* 10-3 =2 ms

Processor speed= 600 MHz=600 Cycles/sec

Cycles required by CPU=300+900 =1200

For DMA=1200

So time=1200/(600 *10 6)=.002 ms

In %=.002/2*100=.1%

So (D) is correct option

Data transfer time= initialization time + DMA transfer time =300+900=1200 cycles

Data preparation time = time disk is taking to transfer 20KB to DMA

= (20KB)/(10MBps) = 2msec or 1200000 cycles

thus CPU time consumed = (transfer time)/(prepartion time + transfer time)

= [1200/(1200000+1200)] * 100

=0.0999 = 0.1%