1.2k views
Please Explain the formulae for % time of CPU blocked in both Cycle Stealing mode and Burst mode of DMA
retagged | 1.2k views

Let , x=  Data preparation time or CPU time   and y=  Data transfer time

When to use which formula:  to find % of cpu time consume   , that depends on the exact wordings in question .

In Cycle Stealing Mode -

In this case we use  ( x/y )

In cycle stealing mode we always follow pipelining concept that means when one byte is getting transferred then at the same time Device is parallel way preparing the next byte.So we use concept of x/y .

example -  explicitly mention it is in cycle stealing mode

Example problem :

Consider a device 1 MBPS is operating in a cycle mode of DMA. Whenever 16 B word is available it is transferred into memory in 4 microsecond.What is the ℅ of time the processor is blocked due to DMA ?

For Cycle Steal Mode :

Data is transferred word by word from DMA to memory .

Here total data size is 16 Bytes . And 1 word = 16 Bytes ( given )

so for 16 B data we need to transfer in 1 word means 1 time bus access is require by DMA.

each cycle time is 4 micro second, to transfer 16 Bytes it takes 1 * 4 =4 micro seconds to transfer 16 Bytes data .

Hence Data preparation time is 4 microseconds .

Now, hard disk transfer rate is 1 MBPS = 10^6 Bytes/sec

so (10^6 * 8 ) bits is sending in 1 sec

1  bit is sending 1/(10^6 * 8 ) sec

so , 16 * 8 bits data is sending in 16 * 8 /(10^6 * 8 ) seconds = ( 16 * 8 /10^6 * 8 ) * 10^6 micro secs = 16 micro secs

so, to transfer 16 Bytes data hard disk needs 16 micro secs ( data transfer time )

Then, % of CPU time consume for DMA operation is : ( 4/16 ) * 100 = 0.25 * 100 = 25%

Ans is 25% CPU time is consumed in Cycle Steal Mode .

----------------

In Burst Mode  -

In this case we use ( x/x+y  )

default is burst mode, when no mode mention explicitly , we use Burst mode .

example : burst mode in both cases ,

Burst mode example problem :

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," Then  what is the percentage of processor time consumed for the transfer operation ?

Clock cycle time = 600 MHz =1/ (600 x 10) seconds

total cycle time for processor is (300+900)=1200 and each cycle time is  1/ (600 x 106  ) seconds

So data preparation time = x , which is 1200 * 1/ (600 x 10) * 106  microsecs = 2 microsec.  This 2 microsec is x .

Now coming to y = data transfer time

here data transfer rate from disk is 10 MB/sec , total data to transfer is 20 KB .

so, Disk Transfer data at a rate of 10 Mbytes/sec

1 byte transfer in 1/107 sec

20 Kbytes transfer in 2 milisec = 2000 micro sec .. this 2000 microsec is data transfer time of y .

now here nothing is mention so we use formula for burst that is x/x+y

so put x and y value and we get the answer.

Percentage of processor time consumed for the transfer operation is (2/2+2000) * 100 = 0.0999 = 0.1% .

See how those questions are framed, then only you understand which mode to use where . In cycle steal they always mention it explicitly.

edited by
0
Thank you so much sir for the explanation.. :)
0

Device is slow as compared to others , it will generate data at a slow speed .

So device will generate data at slow speed . That means it takes Long time to transfer data.

That's why transfer time always greater than cycle time.  And preparation time means total cycle time.

why it is (x/y) and NOT (y/x) ?

the main reason is y > x always. where y = transfer time and x = preparation time.

0
@Bikram sir ,

here, cpu has initiated to dma with 300 cycles and then it gets busy with some other work , after  getting dmarequest it again contacted with DMA with 900 cycles to acknowledge the DMA req .

so total time will include (300+900)*cycle time + Data transfer time
+1
@Bikram sir

"Hence Data preparation time is 8 microseconds."

Is it 4 microsec ? bcz in % of CPU time consumed for DMA operation calculation 4 is used and also only one cycle is needed to transfer 1 word.
0

Thanks..

"Hence Data preparation time is 4 microseconds"

this is correct .. i corrected that typo .

0

here, cpu has initiated to dma with 300 cycles and then it gets busy with some other work , after  getting dmarequest it again contacted with DMA with 900 cycles to acknowledge the DMA req .

yes, correct..

total cycle time for processor is (300+900)=1200

and each cycle time is  1/ (600 x 106  ) seconds

So let data preparation time = x ,

which is 1200 * 1/ (600 x 10) * 106  microsecs = 2 microsec.

to calculate data preparation time , we need to count 1200 cycles..

we don't need total time here, which you calculated..

0
@bikram sir,

thank you  sir

1