Home / Learn / Processor Architecture / In-Order vs Out-of-Order Cores
On this page
Why order mattersHow an in-order core worksHow an out-of-order core worksWhy out-of-order is fasterWhat that speed costsSide by sideSecurityWhere in-order cores are usedWhere out-of-order cores are usedCombining bothThe underlying trade-offAn alternative: let the compiler do itCommon questionsRelated guidesIn-Order vs Out-of-Order Cores
An in-order core executes instructions strictly in the sequence the program gives them. An out-of-order core looks ahead, finds instructions whose inputs are ready and runs them early, then puts the results back in the right order. In-order cores are small, efficient and predictable. Out-of-order cores are considerably faster at running a single thread and much larger and more power-hungry. Most systems use each where it fits.
Why order matters
A program is a sequence of instructions. Often an instruction has to wait: for data to arrive from memory, or for an earlier calculation to finish.
In an in-order core, everything behind the waiting instruction waits too, even instructions that have nothing to do with it and could run immediately. An out-of-order core lets those independent instructions go ahead.
How an in-order core works
Instructions pass through a pipeline of stages: fetched from memory, decoded, executed and their results written back. Each follows the one before.
In-order cores can still be fast. They can have deep pipelines to reach high clock speeds, and some can execute two or more instructions side by side when those instructions are adjacent and independent. What they cannot do is reach past a stalled instruction.
How an out-of-order core works
An out-of-order core adds a layer of machinery around the same basic steps.
- Fetch and decode, in program order, often several instructions at once.
- Rename. Instructions are rewritten to use a large pool of internal registers. This removes false dependencies, where two unrelated instructions merely happen to use the same register name.
- Dispatch. Instructions are placed in a holding structure to wait for their inputs.
- Execute. As soon as an instruction’s inputs are available, it runs, whatever its position in the program.
- Commit. Results are held in a buffer and released in original program order. From the outside, the program appears to have run in sequence.
The core also predicts the outcome of branches and runs instructions speculatively along the predicted path. If the prediction was wrong, the speculative work is thrown away.
Why out-of-order is faster
- It works around delays. While one instruction waits for memory, others proceed.
- It finds parallelism. Independent instructions scattered through the program are run together.
- It overlaps memory accesses. Several slow memory requests can be in progress at once.
- It speculates. Work begins before the processor knows for certain it is needed.
On typical software, a large out-of-order core can be several times faster than a simple in-order one.
What that speed costs
- Area. The renaming logic, scheduling structures and reorder buffer are large. An out-of-order core may take many times the area of an in-order core.
- Power. These structures are active all the time, and speculative work that is discarded wastes energy.
- Design and verification effort. Out-of-order cores are among the most complex digital designs.
- Diminishing returns. Each further increase in size produces a smaller gain in performance.
- Variable timing. How long an operation takes depends on what else the core is doing.
Side by side
| In-order | Out-of-order | |
|---|---|---|
| Execution sequence | Program order | Whatever is ready |
| Single-thread performance | Lower | Higher |
| Area | Small | Large |
| Power | Low | High |
| Performance per watt | Often better | Often worse |
| Timing predictability | High | Low |
| Design complexity | Moderate | Very high |
| Typical use | Embedded, efficiency cores, manycore | PCs, servers, high-end phones |
Security
Speculative execution became a security concern in 2018, when researchers showed that the side effects of speculative work could be used to leak data across security boundaries. Out-of-order cores are the most exposed because they speculate most aggressively.
Processor designers and software developers have added mitigations, at some cost in performance. Simple in-order cores speculate far less and have a smaller exposure to this class of attack.
Where in-order cores are used
- Microcontrollers and embedded systems. Cost and power dominate.
- Efficiency cores. Many phone and PC processors pair a few large cores with several small ones, some of them in-order.
- Manycore processors. With dozens or hundreds of cores on a chip, each must be compact.
- Real-time and safety-critical systems. Predictable timing is easier to guarantee.
- Control processors inside other chips.
Where out-of-order cores are used
- Desktop and laptop processors
- Servers
- High-end phones and tablets
- Any system where the speed of a single thread determines the user’s experience
Combining both
Mixing core types on one chip has become the norm. Demanding tasks go to the large out-of-order cores. Background and light tasks go to small, efficient cores. The system gets fast response when needed and low power consumption the rest of the time. This arrangement is a form of heterogeneous computing.
The underlying trade-off
The choice comes down to what limits the system.
- If the workload is a single thread and speed matters above all, an out-of-order core is worth its cost.
- If the workload is many independent tasks, more total work gets done by filling the same area with many small cores.
- If power or cost is tightly constrained, in-order cores deliver more work per watt.
- If timing must be guaranteed, in-order cores are easier to analyze.
An alternative: let the compiler do it
A third approach moves the scheduling work to the compiler. In a VLIW processor, the compiler decides in advance which operations run together, and the hardware stays simple. It gives some of the parallelism of out-of-order execution with hardware closer to in-order complexity, and works best on regular, predictable code.
Common questions
Does out-of-order execution change a program’s results?
No. Results are committed in the original program order, so the outcome is identical to executing the instructions in sequence.
Are in-order cores obsolete?
No. They are produced in far greater numbers than out-of-order cores, in embedded devices, efficiency cores and manycore chips. They are the better choice wherever area, power or predictability matters most.
Why not make every core out-of-order?
The extra area and power would be wasted in applications that do not need maximum single-thread speed. Many small cores often deliver more total work than a few large ones.