Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-2h6rp Total loading time: 0 Render date: 2024-09-29T02:18:42.993Z Has data issue: false hasContentIssue false

40 - Futures and Speculations

from Part XV - Parallelism

Published online by Cambridge University Press:  05 February 2013

Robert Harper
Affiliation:
Carnegie Mellon University, Pennsylvania
Get access

Summary

A future is a computation whose evaluation is initiated in advance of any demand for its value. Like a suspension, a future represents a value that is to be determined later. Unlike a suspension, a future is always evaluated, regardless of whether its value is actually required. In a sequential setting futures are of little interest; a future of type τ is just an expression of type τ. In a parallel setting, however, futures are of interest because they provide a means of initiating a parallel computation whose result is not needed until (presumably) much later, by which time it will have been completed.

The prototypical example of the use of futures is to implementing pipelining, a method for overlapping the stages of a multistage computation to the fullest extent possible. This minimizes the latency caused by one stage waiting for the completion of a previous stage by allowing the two stages to proceed in parallel until such time as an explicit dependency is encountered. Ideally, the computation of the result of an earlier stage is completed by the time a later stage requires it. At worst the later stage must be delayed until the earlier stage completes, incurring what is known as a pipeline stall.

A speculation is a delayed computation whose result may or may not be needed for the overall computation to finish. The dynamics for speculations executes suspended computations in parallel with the main thread of computation, without regard to whether the value of the speculation is actually required by the main thread.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2012

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Futures and Speculations
  • Robert Harper, Carnegie Mellon University, Pennsylvania
  • Book: Practical Foundations for Programming Languages
  • Online publication: 05 February 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9781139342131.041
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Futures and Speculations
  • Robert Harper, Carnegie Mellon University, Pennsylvania
  • Book: Practical Foundations for Programming Languages
  • Online publication: 05 February 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9781139342131.041
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Futures and Speculations
  • Robert Harper, Carnegie Mellon University, Pennsylvania
  • Book: Practical Foundations for Programming Languages
  • Online publication: 05 February 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9781139342131.041
Available formats
×