Content deleted Content added
JnRouvignac (talk | contribs) No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
mNo edit summary |
||
Line 3:
'''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 computing|concurrent programming]]. The core concept is the encapsulation of concurrent threads of execution (here encompassing kernel and userland threads and processes) by way of control flow constructs that have clear entry and exit points and that ensure all spawned threads have completed before exit. The concept is analogous to [[structured programming]], which introduced control flow constructs that encapsulated sequential statements and subroutines. Such encapsulation allows errors in concurrent threads to be propagated to the control structure's parent scope and managed by the native error handling mechanisms of each particular computer language. It allows control flow to remain readily evident by the structure of the source code despite the presence of concurrency. To be effective, this model must be applied consistently throughout all levels of the program-- otherwise concurrent threads may leak out, become orphaned, or fail to have runtime errors correctly propagated.
The concept was formulated in 2016 by Martin Sústrik (creator of [[ZeroMQ]]),<ref>{{cite web |last1=Sústrik |first1=Martin |title=Structured Concurrency |url=http://250bpm.com/blog:71 |date=7 February 2016 |accessdate=1 August 2019}}</ref>
In 2019, the loom project from [[OpenJDK]] is adopting structured concurrency to bring it to the [[Java platform]] in a future release as part of a larger work on [[lightweight thread]]s and [[coroutine]]s<ref>{{cite web |last1=Bateman |first1=Alan |website=openjdk.java.net |publisher=[[OpenJDK]] |access-date=November 23, 2019 |title=Structured concurrency |url=https://wiki.openjdk.java.net/display/loom/Structured+Concurrency}}</ref>
== Variations ==
A major point of variation is how an error in one member of a concurrent thread tree is handled. Simple implementations will merely wait until the children and siblings of the failing thread run to completion before propagating the error to the parent scope. However, that could take an indefinite amount of time. The alternative is to employ a general cancellation mechanism (typically a cooperative scheme allowing program invariants to be honored) to terminate the children and sibling threads in an expedient manner.
== See also ==
* [[Structured programming]]
|