recategorized by
65,050 views
63 votes
63 votes

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$
recategorized by

12 Answers

Best answer
42 votes
42 votes

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

edited by
64 votes
64 votes

$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

Best matching answer is (B).

edited by
52 votes
52 votes

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

26 votes
26 votes

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!

edited by
Answer:

Related questions

23 votes
23 votes
5 answers
1
Kathleen asked Sep 22, 2014
19,849 views
What is the swap space in the disk used for?Saving temporary html pagesSaving process dataStoring the super-blockStoring device drivers
1 votes
1 votes
1 answer
3
0 votes
0 votes
0 answers
4
Shadan Karim asked Jan 7, 2019
212 views