Structured (Synchronous) Concurrency

https://news.ycombinator.com/rss Hits: 7
Summary

Structured (Synchronous) Concurrency @_fsantanna I have recently learned about Structured Concurrency (SC), which supports nested coroutines with tied lifetimes. There are a number of libraries (Dill, Trio, Effection), and even language mechanisms in Swift and Kotlin. The similarities with Esterel and derived imperative synchronous languages (ISLs) is noteworthy. However, it seems that no bridges between these worlds (ISLs & SC) have been built. Research in ISLs dates back to the early 80s, and constantly reinforces the idea of lexically-scoped tasks with safe cancellation. I believe the most interesting paper to connect SC with Esterel is Berry’s “Preemption in Concurrent Systems” from 1993, which I discuss further. While studying the similarities between Esterel and SC I also wondered how they would compare to other concurrency models. I came up with this diagram to highlight two aspects that I find the most relevant to this discussion: the basic paradigm (procedural vs functional) and the scheduling semantics (synchronous vs asynchronous). The diagram is divided in four quadrants (A,B,C,D), each containing a representative language or mechanism (threads, map-reduce, Esterel, and FRP). The diagram suggests that Esterel and SC (SC libs) are very similar. The gray area in the middle contains flexible mechanisms that could also be adopted in other quadrants. The basic paradigm considers how tasks or units of concurrency are combined in the code. Quadrants A,C (threads and Esterel) rely on typical procedural commands such as loops and assignments. Quadrants B,D (map-reduce and FRP) rely on expressions and functional combinators. The scheduling semantics considers how tasks or units of concurrency execute with respect to the others. Under the synchronous model (quadrants C,D), they execute in locksteps or time ticks, and can only advance together. Under the asynchronous model (quadrants A,B), they execute independently, and require explicit primitives to synchronize. F...

First seen: 2025-08-18 23:48

Last seen: 2025-08-19 05:49