I would suggest you not to use any such formula’s as you might forget them in exams.
Go by concept.
Cycle Stealing Mode: [Data is prepared, DMA initialized, DMA transfer]*Total Number Of Cycles Required
Burst Mode: [Data is Prepared,DMA initialized, DMA transfer*Total Number Of Cycles Required]
In simple words the basic difference is, in Burst Mode you just initialize the DMA only once and then transfer all the data without giving the control back to CPU.
But in Cycle stealing mode, you transfer data then give control back to CPU, again when your data is ready you initialize DMA again and this cycle continues.
Now Let’s solve the problem,
( Inorder to solve it easily convert everything either to cycles or to seconds. Here i am converting everything to cycles )
400 kHz clock frequency,
So 1 cycle = 400kHz = 1/(400 x 10^3) seconds --------eqn(1)
We have to transfer 16B of data.
Harddisk transfer rate is 1KBps,
This means we can prepare our data at a speed of 1KBps.
It is also given that the DMA can transfer 1B of data at a time. So we will now calculate how much time it takes to prepare 1B of data.
1KB -> 1s
1B -> (1/10^3)second
Now i am just converting (1/10^3)seconds into units of cycles.
1/(400 x 10^3) -> 1 cycle
1/10^3 -> 400 cycles.
So it takes 400 cycles to prepare 1B of data.
Now one important thing to note here is CPU will remain blocked when DMA activity (DMA initialisation, DMA transfer, DMA termination) is going on.
CYCLE STEALING MODE:-
Total time = 16*400 + 10 + 2 = 6412
CPU Block time = 16*12 = 192
% of time CPU is blocked = (192/6412)*100 = 2.99 %
Total time = 16*400 + 10 + 16*2 = 6442
CPU block Time = 10 + 16*2 = 42
% of time CPU is blocked = (42/6442)*100 = 0.65 %