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