The library

How a program runs

Account for the time a program spends not running, well enough to say which of the three usual causes you have, to read the system's own view of your process, and to stop guessing at performance from the inside of your code

What Happens While You Wait

A program spends most of its life waiting, and nothing inside the program can see why. This course covers what the operating system is doing in that gap: scheduling, the call across the boundary, waiting for a device, and how to watch it.

8 lessons, written and corrected before you arrived. Reading them here needs no account. The first reads the whole way through; the others open and then stop, because a page nobody owns cannot tell who is reading it. Starting the course gives you your own copy, where every idea has problems standing under it and you can ask about any sentence.

Start reading

  1. 01Your Program Cannot Read a File, and Never CouldThe separation between your code and the kernel is enforced by the processor, not agreed by convention. Here is what your code genuinely cannot do, and the single door it uses to ask.
  2. 02Two Hundred Times the Price, for a Line That Looks the Sameopening onlyA request across the boundary costs hundreds of times what a function call costs, and the reasons are specific. Here is where the time goes, and how to pay it once instead of a thousand times.
  3. 03Your Program Is the Small Part of Your Processopening onlyA process is a pile of things the system holds for you: an address space, a table of open files, an identity, a set of handlers. Splitting one in two reveals exactly which parts are which.
  4. 04The Program That Waits Gets Served First, and It Is Not Being Rewardedopening onlyThe scheduler picks whoever has had least so far. That one rule explains why interactive programs feel fast, why a busy loop does not starve anybody, and what the time slice is trading.
  5. 05Not Running Is Two Different Problems With One Symptomopening onlyA program that is not running is either waiting for a turn or waiting for a device, and the fixes are opposites. Here is what each one does to the numbers you can see from outside.
  6. 06Ten Thousand Connections, One Thread, and One Thing It Still Cannot Doopening onlyA request can be told to answer not yet rather than block. That alone is not enough, and the piece that makes it work is the kernel telling you which requests are ready.
  7. 07Your Handler Runs Between Two Instructions You Did Not Chooseopening onlyA signal arrives in the middle of whatever your program was doing, on the same thread, with every lock it was holding still held. That is the whole reason the rules are so strict.
  8. 08Four Seconds of Wall Clock, Half a Second of Work, and Where the Rest Wentopening onlyThe system keeps an account of your process whether you ask or not. Here is how to read it, how to attribute a slowdown to the processor, a device or a lock, and what the numbers cannot tell you.