8,799 views
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???

Nice pdf

Yes, it will be 1/20.78 in that question..

For cycle stealing mode.

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

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

@kapil

that bus request and bus grant time is less , so generally ignore that time ..

only total time to send data we consider , in every problem we did that. like https://gateoverflow.in/18941/drdo-q32

and here also explicitly said cycle stealing is used so we can use x/y is not it ?

@kapil from where did you get BR+BG=16 ?

@bikram The Dr. do question, they asked how much cpu  is in hold state I.e blocked state. So that was ok. But they are asking how much cpu  is consumed? So 0%

https://gateoverflow.in/285701/me_test_series#c285763

What if the line is as follows

A hard disk with a transfer rate of 1 KBps is constantly transferring data to memory using DMA cycle stealing mode.

The line is explicitly saying it is cycle stealing mode but at the same time it is saying the device is transferring data constantly.

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.

by

@rahul sharma 5

you can read this DMA notes

@Bikram Sir I don't get it. Do this not contradict with the fact that In burst mode data is transferred at the device transfer rate. What is the significance of specifying whether the speed of the bus is given or not?

Yes, in burst mode data is transferred at the device transfer rate .

There are 2 things to remember :

1. Data preparation time ( it is total cycle time )
2. Data transfer time   ( it is how much time it takes to transfer total amount of data )

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

DMA formula is x/x+y where x= data preparation time, y = data transfer time

1 vote