retagged by
10,395 views
20 votes
20 votes
What is formula for % of time CPU gets blocked??

Is it  X(X+Y) or X/Y only???

What is formula for % of time CPU is consumed in Interuppt driven IO??? Formula for % of CPU slow down in interrupt driven IO???
retagged by

2 Answers

Best answer
30 votes
30 votes

For cycle stealing mode.

Lets say that you are asked to find out the percentage for which CPU is blocked.

REF: 
https://gateoverflow.in/113433/madeeasy#a113746
https://gateoverflow.in/1393/gate2005-70
https://gateoverflow.in/17666/how-much-time-will-the-processor-slowed-down-due-dma-activity
https://gateoverflow.in/113433/madeeasy

Lets assume that device transfer rate(i.e the rate at which the device buffer is filled up)is  x bytes/sec


If processor can transfer y bytes(i.e bus length) in 1 cycle(assume 1 cycle of 1 sec ) then bus speed is y bytes/sec.


Now, assume any time slot or time quantum say 1 sec.

Now, in this 1 sec, x bytes will be accumulated in device buffer. If x bytes arent vacated in that 1sec, device buffer will spill.

So, I transfer x bytes acumulated in that 1 sec in device buffer at bus speed. Time taken for this is x/y sec.

Now, out of 1 sec for processor, I consumed x/y sec for device data transfer.


So, processor is slowed by x/y sec for every 1 sec.

Hence, slowdown = (x/y) / (assumed time slot) = (x/y) / 1

Add the interrupt processing time to (x/y) if given.
-------------------------------------------------------------------------------------
For burst mode. ( By default mode) Default is Burst Mode we assume ..

Consider the disk drive with the following specification:- 

16 surfaces, 1024 tracks/surface, 1024 sectors/track, 1KB/sector, rotation speed is 3000 rpm and the disk is operated in burst Mode. The processor runs at 600 MHZ and takes 300 & 900 clock cycle to initiate & complete DMA transfer respectively, if the size of transferred data is 20KB. 

 The percentage of processor time consumed for the transfer operation is__________


Time consumed is only when initiation and completion of DMA takes place i.e 300+ 900 cycles.


Initial time = 300 * (1/ 600 * 10^6 ) = 0.5 microsec 
terminate time = 900 * (1/ 600 * 10^6) = 1.5 microsec 
time for 1 revolution = 60/3000 sec 
so in 1 revoluution data transfer is 1024 KB 
in 1 sec data transfer is  (1024 * 3000 )/ 60 KB = 50 MB ,  now rate is 50 MB/sec 
Data transfer time for 20kB = (20 KB/ 50MB) sec =  400 microsec 

% CPU consumed = [ ( Initial time + termination time)/ total time ] * 100 =  0.49%

Here, total time = initiation + completion + transfer

Note:

In cycle stealing mode,  CPU is interrupted only when the data is ready in buffer. So, transfer of data to MM takes place at speed of bus.

In burst mode, data transfer to MM takes place at device transfer rate.


For interrupt Mode:

CPU time consumed = processing the interrupt + transfer the data in device buffer at bus speed

TOtal time consumed = interval between the interrupts

% consumed = (CPU time consumed) / (total time consumed) * 100

selected by
7 votes
7 votes

Regarding DMA burst mode ,where data to be transferred is k bytes, speed of i/o device is x and speed of bus is y.

1.) I/O device prepares k bytes of data in its buffer for k/x secs meanwhile CPU is operational.Then it request CPU for bus access where some time is spent in initialisaation and then takes k/y secs to transfer the data to memory.

If the speed of the bus is  mentioned . We use this approach.

2.) DMA controller requests for bus access, CPU takes some time for initilazing DMA then device transfers k bytes directly to the memory in k/x sec

 If the speed of the bus is not mentioned . We use this approach.

Related questions

3 votes
3 votes
2 answers
3
1 votes
1 votes
1 answer
4
rahul sharma 5 asked May 27, 2017
1,148 views
In cycle stealing mode,the DMA gets control over ?1. Data and address bus2.Data and control bus3.Address and control bus4. None