Lably
Skip to content

Speculative execution

Technique used in processor design

  • 3 min read
  • 4 chapters

Related on Lably

Through Computer science, Processor (computing) and Guessing

Overview

In speculative execution, work is done before it is known whether it is actually needed, so as to prevent a delay that would have to be incurred by doing the work after it is known that it is needed. If it turns out the work was not needed after all, most changes made by the work are reverted and the results are ignored.

The objective is to provide more concurrency if extra resources are available. This approach is employed in a variety of areas, including branch prediction in pipelined processors, value prediction for exploiting value locality, prefetching memory and files, and optimistic concurrency control in database systems.

Since the results from speculative execution become useless when the guessed work turns out to be wrong (e.g., not needed), its performance benefits are limited by the accuracy of the prediction process.

Speculative multithreading is a special case of speculative execution.

Modern pipelined microprocessors use speculative execution to reduce the cost of conditional branch instructions using schemes that predict the execution path of a program based on the history of branch executions. In order to improve performance and utilization of computer resources, instructions can be scheduled at a time when it has not yet been determined that the instructions will need to be executed, ahead of a branch.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication