in CO and Architecture retagged by
7,037 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 ?

in CO and Architecture retagged by
by
7.0k views

4 Comments

What is the source of this question?
1
1
1
1

@rahul sharma 5   @Arjun sir please reply my head is breaking :p dont u think that the question should be PERCENTAGE OF TIME CPU IS BLOCKED? HOW CAN U CALCULATE PERCENTAGE OF CPU TIME CONSUMED ????????????? WE CAN JUST CALCULATE THE TOTAL CPU TIME CONSUMED 

1
1
@ yes i think it should be % of CPU blocked
1
1

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% . 

by

4 Comments

thanx bikram sir. Very clear explanation.
1
1

@Arjun i think its CPU held up and not consumed.

1
1

@Arjun sir

how can 64 bytes be transferred in singl cycle? in one cycle 1 word will be transferred.

please resolve my doubt. 

1
1
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 .

2 Comments

edited by

Disk rate is 1Mbps ,but you have taken 1 MBps

Also, in option b,it will take 1 cycle to get the bus control and 1 cycle to release and X time to transfer,X=512 microseconds.(1Mbps)

Now,2 cycles will take 4 micorseconds so total DMA operation is :- 4+512= 516 micorseconds.

CPU time consumed :- 4/516

2
2
@Bikram sir,Regarding burst mode

how can 64 bytes can be transferred in single cycle? in one cycle 1 word(8 bytes) will be transferred.

please clear this
1
1
Answer:

Related questions