Abstract

A future is an entity representing the result of an ongoing computation. A synchronisation with a "get" operation blocks the caller until the computation is over, to return the corresponding value. When a computation in charge of fulfilling a future delegates part of its processing to another task, mainstream languages return nested futures, and several "get" operations are needed to retrieve the computed value (we call such futures "control-flow futures"). Several approaches were proposed to tackle this issues: the "forward" construct, that allows the programmer to make delegation explicit and avoid nested futures, and "data-flow explicit futures" which natively collapse nested futures into plain futures. This paper supports the claim that data-flow explicit futures form a powerful set of language primitives, on top of which other approaches can be built. We prove the equivalence, in the context of data-flow explicit futures, between the "forward" construct and classical "return" from functions. The proof relies on a branching bisimulation between a program using "forward" and its "return" counterpart. This result allows language designers to consider "forward" as an optimisation directive rather than as a language primitive. Following the principles of the Godot system, we provide a library implementation of control-flow futures, based on data-flow explicit futures implemented in the compiler. This small library supports the claim that the implementation of classical futures based on data-flow ones is easier than the opposite. Our benchmarks show the viability of the approach from a performance point of view.

Highlights

  • A future [ ] is an entity representing the result of an ongoing computation

  • Data-flow explicit futures are explicit but with a type system and synchronisation semantics that are different from usual explicit futures that use parametric types

  • Our encoding implementation is more complete as it can fully deal with parametric types but its syntax is less nice: we only provide a set of functions and have no way to extend the syntax because our implementation is an Encore library

Read more

Summary

Introduction

A future [ ] is an entity representing the result of an ongoing computation. It is used when launching a sub-task in parallel with the current task to later retrieve the result computed by the sub-task. A future is resolved when the associated value is computed. Futures have been used for more than years and their adoption became wider and reached mainstream object-oriented languages during the last years. Futures are used as a high-level parallelism paradigm in the standard libraries of Java, Scala, JavaScript, C++, or in the Akka and ProActive toolkits. A future is at the same time a container for some data and a way to synchronise processes: programs that use futures wait for the resolution of the future before executing some piece of code

Objectives
Results
Discussion
Conclusion
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.