Issue #34 - Promises
Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems
Another weekend, another weekend read, this time all about Promises, Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems
I am writing a book on Thinking in Distributed Systems. 12 chapters, one chapter per month, full of diagrams, illustrations, and examples, all about distributed systems.
In their paper Promises: Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems, Barbara Liskov and Liuba Shrira describe promises a place holder for a value that will exist in the future. It is created at the time a call is made. The call computes the value of the promise, running in parallel with the program that made the call. When it completes, its results are stored in the promise and can then be “claimed” by the caller.
In other words, a promise is a representation of a future value. A promise is either pending, signaling that the value is not available yet, resolved, signaling the value is available, or rejected, signaling a failure.
In a typical scenario, a downstream function execution creates a promise and awaits its completion while an upstream function execution either resolves or rejects the promise. On completion, the downstream execution resumes with the value of the promise.
In other words, a downstream function execution that gets the value of a promise and an upstream function execution that sets the value of the promise can be interpreted as being in a consumer producer relationship.
Section 2 of the paper describes call-streams, an abstraction that did not gain any significant mindshare. Section 3 of the paper describes promises, an abstraction almost every modern runtime provides.
You can find promises in JavaScript and TypeScript, Python, Rust, Java, Kotlin, or C#. Promises are amongst the original ideas of computer science and a fundamental primitive of coordination.
There is a lot to discover. I promise 🤓
Happy Reading
Promises: Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems
Barbara Liskov & Liuba Shrira
This paper deals with the integration of an efficient asynchronous remote procedure call mechanism into a programming language. It describes a new data type called a promise that was designed to support asynchronous calls. Promises allow a caller to run in parallel with a call and to pick up the results of the call, including any exceptions it raises, in a convenient and type-safe manner. The paper also discusses efficient composition of sequences of asynchronous calls to different locations in a network.



