in CO and Architecture edited by
6,830 views
31 votes
31 votes
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?
in CO and Architecture edited by
6.8k views

5 Comments

/what are the options ?
0
0

@Bikram  sir, As here DMA is used, the 2ms part which is actual data transfer taking place..... is it mean cpu not involved right. just want to confirm that cpu only involved during inital setup and handling of interupt completion

1
1
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 ?
2
2

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.

0
0

Subscribe to GO Classes for GATE CSE 2022

4 Answers

47 votes
47 votes
 
Best answer
$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$
edited by

14 Comments

The 2ms time will be for the data transfer between the peripheral and the DMA. Now the DMA will take 500 cycles to transfer the entire 4KB(as it is given it is burst mode of transfer) of data into the memory during which time the CPU will remain idle.
2
2
can anyone tell me what do we calculate when % of time cpu is blocked is asked in DMA?? The DMA overhead only or the DMA transfer+DMA overhead??

Because in DMA, during DMA transfer CPYU can perform other activities like computational tasks so its not blocked in one way.. Sometimes its difficult to comprehend this from question asked.
1
1
Disk is actively transferring data 100% of time and it is taking disk to prepare 2ms to prepare 4kb of data,so after every 2ms disk will ask processor time.

Processor time used is 1000+500=1500 cycles=1500*50/10^6=75 ms.

so shouldn't it bee 75ms/2ms.Where am i wrong.

 

How are you getting 30us for initialization?
1
1

@rahul sharma 5

2000 KB is transferred in 1 second

 4 KB transfer is (4/2000 ) * 1000 ms = 2 ms

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

=(1000+500) clock cycle = 1500 clock cycle

Now 50 Mhz = 50 * 106 = 0.02 microsecond

so (1500  * 0.02 ) = 30 microsecond

3
3
edited by

My Bad in calculation.thanks you sir for pointing out.

Sir,Question says that 

, if the disk is actively transferring 100% of the time?"

Then this means disk will be interrupting cpu after every 2ms so it should be 30 micro/2 ms ?

How to identify mode here?Its not a cycle stealing as they are transferring 4kb block?So is it burst mdoe?

0
0
yes here burst mode is used.
4
4
30 us and 2ms how u can write this
1
1
@Bikram sir,can you clear my above doubt,what does it mean that disk is ACTIVELY trasferring?Does it mean disk will be interrupting taking bus control after transferring 4kB again and again?
0
0
more precise 1.47 %
4
4
@Bikram sir, 30 microsecond is indirectly the Data Preparation time i.e y in y/(x+y)? Where y=data preparation time and x=Data transfer time. The time for which CPU is busy.
0
0


But the question is asked about the percentage of time consumed by the disk.

Shouldn’t it be 2ms/(2ms + 30 μs ) ?

1
1
yes correct abhilash
0
0

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

0
0
It literally depends on what words you focus first on
0
0
2 votes
2 votes
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

5 Comments

okay i have not consider that table part ! should i consider access time from that table for 4k thing ? please guide and proide the option too
0
0
1/50 = 0.02

Also, 2000 KB is transferred in a second and hence time for 4 KB transfer is 2 ms.
2
2
30 us for initialisation and termination and 2 ms for data transfer% of cpu time consumed =30us/(30us+2ms)*100=1.5%
1
1
conver 2 milliseconds to microsecond dear  2ms=2000 us...so--> (30/2030)*100=1.47%
1
1
@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?
0
0
2 votes
2 votes
(30/30+2000)*100  = 1.4778%
2 votes
2 votes

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
Answer:

Related questions