What happens when I read a file?

One `read()` call is a privilege switch, a descriptor lookup, a file-system mapping from offset to block, a page-cache check, and — on a miss — an SSD command and a DMA transfer while your thread sleeps. Zoom in to see why the second read of the same file is a hundred times faster.

Inputread(fd, buf, 4096)Between `read()` and the bytes in my buffer, how many copies, caches and hardware transfers happen?
ZoomThe mental model most code is written with: ask the OS, get bytes. It hides the difference between 1 µs and 100 µs.
Click a node to see what happens there, what state changes, how it fails, and which lesson explains it. Then zoom to the next level and watch the arrow you clicked expand into its own chain — no step is magic.

Continue with the lessons