Theory and Practice of Coroutines with Snapshots
While event-driven programming is a widespread model for asynchronous computing, its inherent control flow fragmentation makes event-driven programs notoriously difficult to understand and maintain. Coroutines are a general control flow construct that can eliminate control flow fragmentation. However, coroutines are still missing in many popular languages. This gap is partly caused by the difficulties of supporting suspendable computations in the language runtime.
We introduce first-class, type-safe, stackful coroutines with snapshots, which unify many variants of suspendable computing. Our design relies solely on the static metaprogramming support of the host language, without modifying the language implementation or the runtime. We also develop a formal model for type-safe, stackful and delimited coroutines, and we prove the respective safety properties. We show that the model is sufficiently general to express iterators, single-assignment variables, async-await, actors and event streams without inversion of control, backtracking, symmetric coroutines and continuations. Performance evaluations reveal that the proposed metaprogramming-based approach has a decent performance, with workload-dependent overheads of 1.03-2.11x compared to equivalent manually written code, and improvements of up to 6x compared to other approaches.
Thu 19 JulDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
11:00 - 12:40 | Asynchrony and ConcurrencyECOOP Research Papers at Zurich II Chair(s): Todd Millstein University of California, Los Angeles | ||
11:00 25mResearch paper | Fault-tolerant Distributed Reactive Programming ECOOP Research Papers Ragnar Mogk Technische Universität Darmstadt, Lars Baumgärtner Philipps-Universität Marburg, Guido Salvaneschi TU Darmstadt, Bernd Freisleben Philipps-Universität Marburg, Mira Mezini TU Darmstadt DOI | ||
11:25 25mResearch paper | ContextWorkflow: A Monadic DSL for Compensable and Interruptible Executions ECOOP Research Papers Hiroaki Inoue Mitsubishi Electric Corporation, Japan, Tomoyuki Aotani Tokyo Institute of Technology, Atsushi Igarashi Kyoto University, Japan DOI | ||
11:50 25mResearch paper | Theory and Practice of Coroutines with Snapshots ECOOP Research Papers DOI | ||
12:15 25mResearch paper | A Concurrent Specification of POSIX File Systems ECOOP Research Papers Gian Ntzik Imperial College London, Pedro da Rocha Pinto Imperial College London, Julian Sutherland Imperial College London, Philippa Gardner Imperial College London DOI |