An Optimised Flow for Futures: From Theory to Practice

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.

[1]  Franco Mazzanti,et al.  Compositional verification of concurrent systems by combining bisimulations , 2019, Formal Methods in System Design.

[2]  Justine Rochas,et al.  Multiactive objects and their applications , 2017, Log. Methods Comput. Sci..

[3]  Ludovic Henrio,et al.  Godot: All the Benefits of Implicit and Explicit Futures , 2019, ECOOP.

[4]  Gul A. Agha,et al.  ACTORS - a model of concurrent computation in distributed systems , 1985, MIT Press series in artificial intelligence.

[5]  Françoise Baude,et al.  Towards a Scalable Cloud-based RDF Storage Offering a Pub/Sub Query Service , 2012, CLOUD 2012.

[6]  Theo D'Hondt,et al.  Ambient-Oriented Programming in AmbientTalk , 2006, ECOOP.

[7]  Erika Ábrahám,et al.  Behavioral interface description of an object-oriented language with futures and promises , 2009, J. Log. Algebraic Methods Program..

[8]  Cosimo Laneve,et al.  Actors may synchronize, safely! , 2016, PPDP.

[9]  Ludovic Henrio,et al.  First Class Futures: Specification and Implementation of Update Strategies , 2010, Euro-Par Workshops.

[10]  Matthias Felleisen,et al.  The Semantics of Future and an Application , 1999, J. Funct. Program..

[11]  Ludovic Henrio Data-flow Explicit Futures , 2018 .

[12]  Robert H. Halstead,et al.  MULTILISP: a language for concurrent symbolic computation , 1985, TOPL.

[13]  Carl Hewitt,et al.  The incremental garbage collection of processes , 1977 .

[14]  Einar Broch Johnsen,et al.  Parallel Objects for Multicores: A Glimpse at the Parallel Language Encore , 2015, SFM.

[15]  Joachim Niehren,et al.  A concurrent lambda calculus with futures , 2006, Theor. Comput. Sci..

[16]  Denis Caromel,et al.  Programming, Composing, Deploying for the Grid , 2006, Grid Computing: Software Environments and Tools.

[17]  Einar Broch Johnsen,et al.  An Asynchronous Communication Model for Distributed Concurrent Objects , 2004, Proceedings of the Second International Conference on Software Engineering and Formal Methods, 2004. SEFM 2004..

[18]  Frank S. de Boer,et al.  A Complete Guide to the Future , 2007, ESOP.

[19]  Reiner Hähnle,et al.  ABS: A Core Language for Abstract Behavioral Specification , 2010, FMCO.

[20]  Denis Caromel,et al.  Promised messages: recovering from inconsistent global states , 2007, PPOPP.

[21]  Elias Castegren,et al.  Forward to a Promising Future , 2018, COORDINATION.

[22]  Matthias Felleisen,et al.  The semantics of future and its use in program optimization , 1995, POPL '95.

[23]  Joachim Niehren,et al.  Observational Semantics for a Concurrent Lambda Calculus with Reference Cells and Futures , 2007, MFPS.

[24]  Denis Caromel,et al.  GCM: a grid extension to Fractal for autonomous distributed components , 2009, Ann. des Télécommunications.