CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 7 of 7 · 3 min read

Exercises

Easy

Easy 1: One turn (20 minutes)

A drive spins at 5,400 RPM. Find the time of one turn and the average rotational delay.

Done when: 11.11 ms and 5.56 ms.

Hint

one turn = 60,000 / RPM in ms. Halve it.

Easy 2: A faster spindle (20 minutes)

Find the average rotational delay at 10,000 RPM.

Done when: 3.0 ms, with the full turn of 6.0 ms shown.

Hint

the same two steps as Easy 1.

Easy 3: Transfer time (20 minutes)

A drive moves data at 150 MB/s. How long does a 64 KiB transfer take?

Done when: 0.437 ms (65,536 / 150,000,000 s).

Hint

divide 65,536 bytes by 150,000,000 bytes per second.

Medium

Medium 1: A 16 KiB request (45 minutes)

A made-up drive has 7,200 RPM, an 8 ms average seek and a 120 MB/s peak rate. Find the I/O time and the rate of a random 16 KiB read.

Done when: 4.167 ms of rotation, 0.137 ms of transfer, an I/O time of 12.303 ms and a rate of 1.33 MB/s.

Hint

add the three delays, then divide 16,384 bytes by the time.

Medium 2: Half of the peak (45 minutes)

Using the made-up drive of section 3 (9 ms seek, 7,200 RPM, 100 MB/s), find the request size at which the rate is half of the peak.

Done when: a size of about 1.32 MB, from the rule that transfer time must equal the positioning time of 13.167 ms.

Hint

the rate is half when transfer time equals seek plus rotation. Multiply that time by 100 MB/s.

Medium 3: Measure it (45 minutes)

Compile the program of section 4 and run it on a file of at least 1 GiB on your machine. Run it three times. Also read /sys/block/<disk>/queue/rotational for the disk that holds the file.

Done when: you report six rates, the rotational flag, and one sentence that says whether your disk shows the gap that the made-up drive predicts.

Hint

if rotational is 0, expect a small gap and say why.

Hard

Hard 1: Many mid-size reads (90 minutes)

An application issues 1,000 random reads of 64 KiB (65,536 bytes) on the drive of section 3. Find the total time and the rate. Compare with reading the same 65.536 MB as one sequential block.

Done when: 13.822 ms per read, a total of 13.82 s and a rate of 4.74 MB/s for the random case, and 668.5 ms and 98.03 MB/s for the sequential case, with a factor of about 20 between them.

Hint

64 KiB is 65,536 bytes. For the sequential case there is one seek and one rotation.

Hard 2: Request size against rate (90 minutes)

Extend the program of section 3 so that it prints the rate for request sizes of 4 KiB, 64 KiB, 1 MiB, 16 MiB and 256 MiB on the made-up drive. Add a column with the percentage of the peak rate.

Done when: the percentage rises with size, is about 50% near 1.3 MB, and is above 90% for a size of about 11.85 MB.

Hint

the percentage is rate divided by 100 MB/s. For 90%, transfer time is 9 times the positioning time.

Hard 3: Two drives (90 minutes)

Compare a 15,000 RPM drive (4 ms seek, 125 MB/s) with a 7,200 RPM drive (9 ms seek, 105 MB/s). Find the random 4 KiB rate and the sequential 100 MB rate of each, then say which cost matters more for a database and which for a video archive.

Done when: about 0.68 and 0.31 MB/s for random, about 124 and 103.6 MB/s for sequential, and one sentence for each use that names the figure that decides it.

Hint

transfer time is the size divided by the peak rate. Recompute the rotation for each RPM.