liveBook · Manning

Speculative execution

Speculative execution is a processor technique that performs predicted work before its need or correctness is confirmed, discarding results if the prediction is wrong.

How 2 Manning books explain it

Latency

Speculative execution is a processor technique that executes predicted future instructions before their dependencies or control-flow conditions are confirmed.

How it is used
Hides latency by starting predicted work before its result is confirmed as necessary.
How deep it goes
Defines early execution and examines prediction costs, without detailing CPU predictor circuitry or a runnable implementation.
Examples
Uses speculative CPU loads and branches alongside login-time prefetching of user-specific data.
What you can do after
Evaluate/understand it by weighing hidden latency against wasted resources and possible latency increases from failed predictions.

Read how Latency explains speculative execution →

Hacking Cryptography

Speculative execution is processor execution of predicted instruction paths before the corresponding control-flow decisions are resolved.

How it is used
Connects processor performance features to timing attacks against cryptographic implementations.
How deep it goes
Explains prediction, pipeline flushing, cache effects, and a C performance comparison, but stops short of a complete attack trace.
Examples
Uses a 100-million-element integer array, a threshold branch, branchless conditional move, and measured sorted versus unsorted timings.
What you can do after
Apply branchless comparisons and avoid secret-dependent branching when implementing timing-sensitive cryptographic code.

Read how Hacking Cryptography explains speculative execution →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.