Instruction-Level Parallelism & Out-of-Order Execution

dynamic scheduling

Picture a busy diner where the cook does not insist on starting dishes strictly in the order tickets came in. If the next ticket needs an ingredient that is still in the oven, a good cook starts a later ticket whose ingredients are already on the counter, keeping the kitchen busy. Dynamic scheduling is the hardware doing exactly this with instructions: deciding at run time, instruction by instruction, what to execute next based on which inputs are ready — rather than blindly following program order.

Concretely, in a statically scheduled (in-order) pipeline, if instruction N stalls waiting for a slow value, every instruction behind it stalls too, even ones that are perfectly ready. Dynamic scheduling breaks this logjam. Each instruction waits in a buffer (a reservation station) until its operands arrive; the moment an instruction's inputs are all available and an execution unit is free, it runs — possibly before an earlier instruction that is still waiting. The hardware tracks all the in-flight dependences itself. Tomasulo's algorithm is the classic recipe for doing this, and dynamic scheduling is what makes out-of-order execution possible.

It matters because the worst stalls — cache misses, slow divides, long dependence chains — are unpredictable, and only run-time decisions can route around them. The compiler, scheduling statically, cannot know whether a particular load will hit or miss. The price is complexity: dynamic scheduling needs renaming, buffering, and tracking logic that costs area and power. And it never changes the program's visible answer — instructions execute out of order but commit in order, so the results you observe are exactly as if everything ran sequentially.

Instruction 1 'load x2 = [x1]' misses the cache (hundreds of cycles). Instruction 2 'add x5 = x3 + x4' has its inputs ready. A dynamically scheduled core runs instruction 2 now instead of idling, then runs instruction 1's dependents once the load finally returns.

Run whatever is ready now; let the stalled instruction catch up later.

Dynamic scheduling reorders execution, not the program's meaning. It pairs with in-order commit precisely so that, despite all the shuffling inside, the architectural state changes in the original program order.

Also called
hardware scheduling硬體排程