32,424 views

Consider a disk drive with the following specifications:

$16$ surfaces, $512$ tracks/surface, $512$ sectors/track, $1$ KB/sector, rotation speed $3000$ rpm. The disk is operated in cycle stealing mode whereby whenever one $4$ byte word is ready it is sent to memory; similarly, for writing, the disk interface reads a $4$ byte word from the memory in each DMA cycle. Memory cycle time is $40$ nsec. The maximum percentage of time that the CPU gets blocked during DMA operation is:

1. $10$
2. $25$
3. $40$
4. $50$

What would be the answer if the % CPU consumed would have been asked with the same data?
Can the question be framed in such a way that the bytes read and bytes written will be different?

if yes, how should we solve it?

if no, why not?

@itssandeepverma

What is the difference between the amount of cpu time consumed and the amount of time that the cpu gets blocked

I think both are same.

First lets calculate the disk transfer rate.

Only one surface is read/written at a time.

• In one rotation, one track is read
• One track has $512$ sectors and $1\;KB$ per sector means $512\;KB$ per track
• Rotations Per Minute is $3000\implies 3000 \times 512\;KB$ per minute or $50 \times 512\;KB = 25600\;KBps$
• Time to read $4$ bytes $= \dfrac{4}{25600 \times 1024} s = 152.6 ns$
• Since memory cycle time is $40\; ns$ this will be $\left \lceil \dfrac{152.6}{40} \right\rceil =4$ cycles.

Now, coming to DMA, it does not block the CPU directly but it steals the memory cycles and if the CPU is needing memory it gets blocked. So, in worst case (see the usage “maximum percentage of time” in question) lets assume CPU is needing memory all the time (fully memory bound process execution). In this case the percentage of time CPU gets blocked will be the amount of time DMA is using the memory cycles.

• Whenever $4$ bytes is ready from disk, memory cycles are taken – this needs $40\;$ ns
• When memory cycles are used, disk will continue to fetch further data – it is not getting blocked here or the disk wont be waiting for this $40\;ns$ if it has any pending read
• That is, if DMA is continuously transferring data, one in every $4$ memory cycles can get blocked.

So, the maximum percentage of time CPU gets blocked $= \dfrac{1}{4} \times 100 = 25 \%$

Correct Option: B

Reference

by

here 4 memory cycles are taken as transfer time.normally we do (40/152.58)=26%

although @HitechGa has mentioned the reason. My doubt is, in every cycle stealing mode question, will I have to take the nearest number of cycles (like here 4 cycle) like this? or should I just do like normal process and get answer like 26%.I mean if this were NAT,then how could I know what they are mentioning

Nice explanation

$512$ KB-$1/50$  sec

$4$ Byte transfer will take total :$4/(512\times50\times2^{10})=152.58 \ ns$

DMA will transfer $4$B in $40$nsec

So, Cpu will be blocked $(40/152.58)=26 \%$ of time

by

why did we consider by default pipeline here while we have not considered it here in this gate question

https://gateoverflow.in/3694/gate2004-it-51

why are we not considering the avg. rotational latency and the seek time here.

B. 25

Does 3000 rotations in 60 seconds

$\implies$ 1 rotation in 20 ms

In 1 rotation covers data in 1 track which is = 512 × 1 KB
20 ms $\longleftrightarrow$ 512 KB
1 sec $\longleftrightarrow$ 25600 KB
$\implies$ Transfer rate = 25600 KBps
Transfer Rate means we can perform read or write operations(one at a time) with this speed.
In one DMA cycle of 40 ns we are able to transfer 4 Bytes to disk.

CPU Idle Time = 40 ns
Data Prepration Time = $\frac{4 Bytes}{25600 KB}$ = 156.25 ns

% Time CPU Blocked = $\frac{40 ns}{40 ns + 156.25 ns} \times 100$ = 20.382

why haven't u multiplied by 16 bcoz in one rotation it can cover all 16 surfaces ??

@sushmita I think the cpu should be idle. It may not access the system bus also since the DMA will be using it, and if does not access the system bus, then how can it carry out even the smaller RTL activities?

it depends on disk architecture whether there are read-write heads on all surfaces or not. you can check it by matching options. here option only matches without taking 16 surfaces.

Rotation Speed = 3000 rpm = 50rps, 1round = $\frac{1}{50}$ seconds

Track Capacity = $512*1024 = 2^{19} =512KB$

Bytes to be transferred = 4B
Transfer Time =  $\frac{4}{50*512*1000}$ = 156.25ns  =4 memory cycles

So, One out of every 4 cycles will be stolen = that is 25% (CPU % Block)

It means CPU will only be blocked for 1 cycle, and for remaining 3 cycles it will be busy doing its own work!