retagged by
6,988 views
12 votes
12 votes

A) Consider $1$mbps hard-disk is interfaced to the processor in a cycle stealing mode of DMA whenever $64$ bytes of data is available in the buffer,then it is transferred to main memory (1 word = $64$ bits) and machine cycle time is $2$ micro sec. Then, percentage of CPU time consumed for DMA operation is ?



B) Percentage of CPU time consumed for DMA operation, if burst mode is used ?

retagged by

2 Answers

13 votes
13 votes

A) Cycle Stealing Mode - 1 byte is transferred at a time. Then BR (Bus Request) is sent and BG (Bus Grant) is given this process is repeated until entire data is sent. So, for 64 bytes we need 64 cycles of CPU time assuming BR and BG is done in one machine cycle. Each cycle being 2 micro second, totally it takes 128 micro seconds.

Data transfer time = Data/Speed + CPU Time = 64*8 bits/1 Mbps + 128 = 640 microseconds

So, % of CPU cycles = 128/640 * 100 = 20%. 

B) In Burst Mode entire data is sent together and CPU is not given BUS access during this time. But CPU is free to perform non-memory operations.

So, % of CPU cycle used = 0%

PS: Not sure if we should use word size here as usually cycle stealing mode is per byte - https://en.wikipedia.org/wiki/Direct_memory_access

Also machine cycle is the time to complete one machine instruction and is different from clock cycle.

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

Edit:

A) For Cycle Steal Mode :

Data is transferred word by word from DMA to memory .

Here total data size is 64 Bytes .  And 1 word = 64 bits is given , 64 bits = 8 Bytes 

so for 64 B data we need to transfer 8 words means 8 times bus access is require by DMA. 

each cycle time is 2  micro second, to transfer 64 Bytes it takes  8 * 2 =16 micro seconds to transfer 64 Bytes data .

so Data preparation time is 16 microseconds .

Now, hard disk transfer rate is 1 MBPS = 106 Bytes/sec

so (106 * 8 ) bits is sending in 1 sec 

1 *  bit  is sending 1/(106 * 8 ) sec

64 * 8 bits data is sending in  64 * 8 /(106  * 8 ) seconds = ( 64 * 8 /106  * 8 ) * 106 micro secs = 64  micro secs 

so, to transfer 64 Bytes data hard disk needs 64 micro secs

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

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

B) For burst mode, CPU can not use the bus for the entire time when DMA transfer data .

In Burst Mode , entire data is transferred in a single cycle ( means in 1 cycle )

so 64 Bytes is transferred in 1 Cycle. And Cycle time is given as 2 Microsec so Data preparation time is 2 Microseconds.

Hard disk transfer rate is 1 MBPS = 106 Bytes/sec

so 106 Bytes is sending in 1 sec 

1 Byte  is sending 1/(106 * 8 ) sec

64 Bytes data is sending in  64  /(106   ) seconds = ( 64  /106   ) * 106 micro secs = 64  micro secs 

Data transfer time is 64 Micro secs.

 First we access the Bus for 2ms and then transfer for 64 ms .

so, % of time cpu consume is :2/(2+64)=  ~ 0.030 * 100 = 3.030 % = ~3  approximately

 Hence % of time cpu consume in Burst Mode is approximately 3% . 

6 votes
6 votes

A) For Cycle Steal Mode :

Data is transferred word by word from DMA to memory .

Here total data size is 64 Bytes .  And 1 word = 64 bits is given , 64 bits = 8 Bytes 

so for 64 B data we need to transfer 8 words means 8 times bus access is require by DMA. 

each cycle time is 2  micro second, to transfer 64 Bytes it takes  8 * 2 =16 micro seconds to transfer 64 Bytes data .

so Data preparation time is 16 microseconds .

Now, hard disk transfer rate is 1 MBPS = 106 Bytes/sec

so (106 * 8 ) bits is sending in 1 sec 

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

64 * 8 bits data is sending in  64 * 8 /(106  * 8 ) seconds = ( 64 * 8 /106  * 8 ) * 10micro secs = 64  micro secs 

so, to transfer 64 Bytes data hard disk needs 64 micro secs

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

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

[ in case of cycle steal formula use : x/y where x= data preparation time, y = data transfer time ]

B) For burst mode, CPU can not use the bus for the entire time when DMA transfer data .

In Burst Mode , entire data is transferred in a single cycle ( means in 1 cycle )

so 64 Bytes is transferred in 1 Cycle. And Cycle time is given as 2 Microsec so Data preparation time is 2 Microseconds.

Hard disk transfer rate is 1 MBPS = 106 Bytes/sec

so 106 Bytes is sending in 1 sec 

1 Byte  is sending 1/(10* 8 ) sec

64 Bytes data is sending in  64  /(106   ) seconds = ( 64  /106   ) * 10micro secs = 64  micro secs 

Data transfer time is 64 Micro secs.

 First we access the Bus for 2ms and then transfer for 64 ms .

so, % of time cpu consume is :2/(2+64)=  ~ 0.030 * 100 = 3.030 % = ~3  approximately

 % of time cpu consume in Burst Mode is approximately 3% . 

And Default is Burst Mode .

Answer:

Related questions

1 votes
1 votes
1 answer
3