Chapter 25

Waiting for Disk

This chapter is a case study of a program that writes and then reads 40MB from disk and from SSD, similar to the program in Chapter 5. The delays waiting for disk are slightly surprising.

From our framework, this chapter is about not running while waiting for disk. A runnable process can wait for a disk because it is reading data that has not yet arrived or because it is writing data that can no longer be buffered in memory by the file system. We will force both to happen.


25.1 The Program

Program mystery25 initializes a 40MB array to random bytes, writes it to disk, synchronizes the file system, and then reads ...

Get Understanding Software Dynamics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.