How a GPU Stays Busy While Every One of Its Workers Is Waiting for Memory
Last timeOne Program, Many Values
A processor spends chip making each wait for memory short. A GPU leaves the wait long and keeps enough other groups ready that something can always run.
The wait for memory
The last lesson left a group of workers sharing one stream of instructions. The stream runs on a unit of arithmetic hardware. This lesson is about how much of the time that unit is doing anything.
The trouble is memory. Arithmetic on values already in hand takes a step or so. Fetching a value from the device's main memory takes far longer. NVIDIA's CUDA C++ Best Practices Guide (2026 edition) puts the delay for memory that is not held close by at hundreds of clock cycles.
A processor attacks the wait itself. It spends a large share of its chip on fast storage close to the arithmetic and on guessing what will be asked for next, so that most fetches come back almost at once. That is part of what the first lesson's expensive worker was paying for.
A plain worker has none of that. To keep the numbers small enough to draw, suppose a group runs for one step, asks for memory, waits three steps, and then runs again. A unit holding that one group is busy one step in four.
Switch instead of wait
The observation that rescues the design is that waiting uses no arithmetic. A group that has asked for memory needs nothing from the unit until the answer arrives. So the unit can run a different group in the meantime.
| step | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| the unit | group A | group B | idle | idle | group A | group B | idle | idle | group A | group B |
| group A | running | waiting | waiting | waiting | running | waiting | waiting | waiting | running | finished |
| group B | ready, no unit free | running | waiting | waiting | waiting | running | waiting | waiting | waiting | running |
Busy for 6 of 10 unit steps, 60 per cent. A free unit goes to the first ready task, top to bottom.
Two groups are better than one and still leave gaps. Add two more.
The lesson stops here
5 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents