Sub topic 4
Computing Disk Access Time
Prerequisites and the basic model
This chapter assumes that you understand binary units, simple ratios, and basic operating-system terms such as a device and a system call. We focus on magnetic hard-disk drives, where a mechanical head moves across rotating platters.
Disk access time is the time needed to locate and transfer requested data. A useful model is:
\[ T{\text{access}} = T{\text{seek}} + T{\text{rotational}} + T{\text{transfer}} \]
Controller delays and queuing delays may also exist, but many problems omit them.
Seek time
Seek time is the time required to move the read/write head to the correct track. It depends on how far the head must move and on the drive's mechanics.
A problem may give the seek time directly. If it gives the head movement and a seek-time rate, use the stated relationship. Do not confuse seek time with the time spent waiting for the desired sector to rotate under the head.
Rotational latency
After the head reaches the correct track, the disk may need to rotate until the requested sector is underneath the head.
The time for one complete rotation is:
\[ T_{\text{rotation}} = \frac{60{,}000}{\text{RPM}}\text{ ms} \]
For a randomly placed request, the average rotational latency is half of one rotation:
\[ T{\text{rotational}} = \frac{1}{2} \times T{\text{rotation}} \]
For a disk rotating at 7,200 RPM:
\[ T_{\text{rotation}} = \frac{60{,}000}{7{,}200} = 8.33\text{ ms} \]
The average rotational latency is therefore about 4.17 ms.
Transfer time
Transfer time is the time required to read the requested sectors after the first sector is positioned under the head.
If a track contains \(S\) sectors and the request reads \(n\) sectors:
\[ T{\text{transfer}} = T{\text{rotation}} \times \frac{n}{S} \]
For example, reading 8 of 400 sectors on a 7,200 RPM disk takes:
\[ 8.33 \times \frac{8}{400} = 0.167\text{ ms} \]
The complete calculation is:
| Component | Time |
|---|---|
| Seek | 9.00 ms |
| Average rotational latency | 4.17 ms |
| Transfer of 8 sectors | 0.17 ms |
| Total | 13.33 ms |
def access_time_ms(seek_ms, rpm, sectors_per_track, sectors_read):
rotation_ms = 60_000 / rpm
rotational_latency_ms = rotation_ms / 2
transfer_ms = rotation_ms * sectors_read / sectors_per_track
return seek_ms + rotational_latency_ms + transfer_ms
total = access_time_ms(9, 7200, 400, 8)
print(round(total, 2)) # 13.33Common errors
- Using RPM directly as milliseconds instead of converting it to rotation time.
- Adding a full rotation for average latency instead of half a rotation.
- Forgetting that transfer time is only a fraction of one rotation.
- Mixing seconds and milliseconds in the same calculation.
- Including seek time when a question asks only for rotational latency.
Exercise
A disk rotates at 10,000 RPM. What is its average rotational latency?
Show answer
One rotation takes 60,000 / 10,000 = 6 ms. The average latency is half of that, or 3 ms.