Structured (Synchronous) Concurrency
5 days ago
- #concurrency-models
- #structured-concurrency
- #esterel
- Structured Concurrency (SC) supports nested coroutines with tied lifetimes, with libraries like Dill, Trio, and Effection, and language mechanisms in Swift and Kotlin.
- Similarities exist between SC and imperative synchronous languages (ISLs) like Esterel, but no bridges have been built between these worlds.
- Berry’s 1993 paper "Preemption in Concurrent Systems" is key to connecting SC with Esterel, emphasizing lexically-scoped tasks with safe cancellation.
- A diagram compares concurrency models based on paradigm (procedural vs. functional) and scheduling semantics (synchronous vs. asynchronous), placing Esterel and SC in the same quadrant.
- Synchronous semantics (quadrants C, D) require lockstep execution, while asynchronous semantics (quadrants A, B) allow independent execution with explicit synchronization.
- Berry’s paper highlights the need for orthogonal abortion primitives in time-dependent models, contrasting with time-independent languages that can only handle "may" preemption.
- The Synchronous Hypothesis (SH) in ISLs like Esterel assumes internal operations are atomic and instantaneous, making them suitable for reactive applications.
- SC’s "clean nested lifetimes" align with ISLs' orthogonal abortion mechanisms, placing SC in the synchronous quadrant (C), hence "Structured (Synchronous) Concurrency."