Structured concurrency
Structured concurrency is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by using a structured approach to concurrent programming. The core concept is that when control splits into concurrent tasks that they join up again, and that this control flow is readily evident by the structure of the source code. If a "main task" splits into several concurrent sub-tasks then those sub-tasks must terminate before the main task can complete. To be effective, this model must be applied consistently throughout the program-- otherwise concurrent tasks may leak out, become orphaned, or fail to have runtime errors correctly propagated.
The naming is inspired by structured programming, which created higher level control-flow statements out of the very basic goto. Similarly, structured concurrency creates higher level mechanisms for concurrency constructs out of the basic concurrent task creation constructs (spawn, threads, fibers).
The concept was formulated in 2016 by Martin Sústrik (creator of ZeroMQ)[1], and then further refined in 2018 by Nathaniel J. Smith, who implemented it in Trio.[2] Meanwhile, Roman Elizarov independently came upon the same ideas while developing an experimental coroutine library for the Kotlin language.[3][4]
See also
References
Citations
- ^ Sústrik, Martin (7 February 2016). "Structured Concurrency". Retrieved 1 August 2019.
- ^ Smith, Nathaniel J. (25 April 2018). "Notes on structured concurrency, or: Go statement considered harmful". Retrieved 1 August 2019.
- ^ Elizarov, Roman (12 September 2018). "Structured concurrency". Retrieved 21 September 2019.
- ^ Elizarov, Roman (July 2019). Structured concurrency (Videotape). Hydra Distributed computing conference. 42 minutes in. Retrieved 21 September 2019.
We needed a name and we needed to finalize this whole concept [...] and we stumble onto this blog post [...] by Nathaniel J. Smith.
External links
- Structured Concurrency, Alan Bateman, OpenJDK wiki
- Structured concurrency forum, cross-computer-language discussion of structured concurrency with participation by Sústrik, Smith, and Elizarov