• recategorized by
127,972 views
86 86 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$

17 Answers

Best answer
75 75 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$ per second =  $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
79 79 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 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

31 31 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
12 12 votes

Please see the solution given by an IIT professor for the same problem with a little change in parameters in the following

6 6 votes
Time takes for 1 rotation = 60/3000
It reads 512*1024 Bytes in one rotation.
Time taken to read 4 bytes = 153 ns
153 is approximately 4 cycles (160ns)
Percentage of time CPU gets blocked = 40*100/160 = 25
Answer:
Position:
Show:

Related questions

197 197 votes
9 answers 9 answers
78.4k
78.4k views
Kathleen asked Sep 22, 2014
78,389 views
A $5$ stage pipelined CPU has the following sequence of stages:IF – instruction fetch from instruction memoryRD – Instruction decode and register readEX – Execute: ALU op...
75 75 votes
4 answers 4 answers
24.5k
24.5k views
go_editor asked Sep 29, 2014
24,526 views
On a non-pipelined sequential processor, a program segment, which is the part of the interrupt service routine, is given to transfer $500$ bytes from an I/O device to mem...
32 32 votes
3 answers 3 answers
15.4k
15.4k views
gatecse asked Sep 21, 2014
15,420 views
Let $f(x)$ be the continuous probability density function of a random variable $x$, the probability that $a < x \leq b$, is :$f(b-a)$$f(b) - f(a)$$\int\limits_a^b f(x) dx...
36 36 votes
6 answers 6 answers
26.5k
26.5k views
Kathleen asked Sep 22, 2014
26,484 views
What is the swap space in the disk used for?Saving temporary html pagesSaving process dataStoring the super-blockStoring device drivers