An Optimised Flow for Futures: From Theory to Practice

07/15/2021
by   Nicolas Chappe, et al.
0

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.

READ FULL TEXT

Authors

page 5

page 39

09/10/2020

Disjunctive Delimited Control

Delimited control is a powerful mechanism for programming language exten...
06/13/2018

Dependently Typed Folds for Nested Data Types

We present an approach to develop folds for nested data types using depe...
08/03/2018

Data-Flow Guided Slicing

We propose a flow-insensitive analysis that prunes out portions of code ...
08/29/2017

Cryptographically Secure Information Flow Control on Key-Value Stores

We present Clio, an information flow control (IFC) system that transpare...
11/26/2021

Modular Information Flow through Ownership

Statically analyzing information flow, or how data influences other data...
06/09/2011

A Knowledge Compilation Map

We propose a perspective on knowledge compilation which calls for analyz...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.