# Why when calculating how long it would take to read a file from a harddrive do I not use transfer speed per sector?

I'm working on a problem from my textbook (not homework, just an example), and it asks us to calculate the 'best case' scenario of reading a 1MB file from the hard drive.

I don't know why the right way to calculate the total time involves the max time for a single rotation. Also in the answer they said that a 1MB file would have 10,000 512-byte logical blocks, how is that calculated? Wouldn't a sector have 512-bytes, so wouldn't the file take 1954 512-byte sectors?

This link has a similar question (almost identical), and yet the 1MB file in their example uses 2000 logical blocks.

I suppose my question boils down to, how are the amount of logical blocks determined? And furthermore, what's wrong with my assumptions/calculations?

Here's the information that it gave me:

Parameter Value
Rotational Rate 13,000RPM
TAvgSeek 6ms
Avg # Sectors/track 5,000
Surfaces 4
Sector Size 512-bytes

# Here's What I Did:

Here's what my thought process was, first calculate the average time it takes to find the first sector of the file in the track:

Tavg-rotation = (1/2) * 60s/13,000RPM * 1,000ms/sec
Tavg-rotation = 2.30ms

Next, I found the time to transfer a single sector:
Ttrans = 60s/13,000RPM * (1 Track/5000 sector) * 1,000ms/sec
Ttrans = 0.00092308 ms

And then finally I added the time for the spindle to find the track, plus the time to find the first sector of the file, plus the time it takes to read all the sectors in the file:
Ttotal = Tseek + Tavg-rotation + Ttrans*1MB*(1sector/512bytes)
Ttotal = 6ms + 2.30ms + 1.80ms
Ttotal = 10.10ms

This is apparently the wrong answer...

# Here's What the Textbook Did:

This is a good check of your understanding of the factors that affect disk performance. First we need to determine a few basic properties of the file and the disk. The file consists of 10,000 512-byte logical blocks. For the disk, Tavg seek = 6 ms, Tmax rotation = 4.61 ms, and Tavg rotation = 2.30 ms.

A. Best case:
In the optimal case, the blocks are mapped to contiguous sectors, on the same cylinder, that can be read one after the other without moving the head. Once the head is positioned over the first sector it takes two >>full rotations (5,000 sectors per rotation) of the disk to read all 10,000 >>blocks.
So the total time to read the file is Tavg seek + Tavg rotation + 2 × >>Tmax rotation = 6 + 2.30 + 9.22 = 17.52 ms.

Computer Systems, A Programmer's Perspective 3ed, pg 631, pg697
Briant & O'Hallaron

I hope I provided enough information!

• (The T rotations got to be somewhat of a misnomer: time for rotation shouldn't vary much, latency due to rotation does depend on rotational position.) Commented Dec 14, 2023 at 8:57
• For some reason your first comment's link is giving me a 404, but I'll add the textbook name and title. Commented Dec 14, 2023 at 20:51
• Thanks for the headsup, I've formatted and fixed everything. Commented Dec 14, 2023 at 21:28

• How did you get the 2,000 sectors though? Wouldn't fileSize/sectorSize be the amount of sectors it takes up? Commented Dec 14, 2023 at 21:06