Content deleted Content added
Artoria2e5 (talk | contribs) No edit summary |
SafariScribe (talk | contribs) Adding local short description: "Programming paradigm for improving clarity and development time of a computer program", overriding Wikidata description "programming paradigm aimed at improving programming via a structured approach to concurrent programming" |
||
(14 intermediate revisions by 9 users not shown) | |||
Line 1:
{{Short description|Programming paradigm for improving clarity and development time of a computer program}}
{{Programming paradigms}}▼
'''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]].
'''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.▼
▲
== History ==▼
The [[fork–join model]] from the 1960s, embodied by multiprocessing tools like [[OpenMP]], is an early example of a system ensuring all threads have completed before exit. However, Smith argues that this model is not true structured concurrency as the programming language is unaware of the joining behavior.<ref name=smith/>▼
Structured concurrency is analogous to [[structured programming]], which uses control flow constructs that encapsulate sequential statements and subroutines.
The concept was formulated in 2016 by Martin Sústrik (creator of [[ZeroMQ]]) with his C library libdill,<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> and then further refined in 2018 by Nathaniel J. Smith, who implemented it in a Python library called Trio.<ref name=smith>{{cite web |last1=Smith |first1=Nathaniel J. |title=Notes on structured concurrency, or: Go statement considered harmful |url=https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ |date=25 April 2018 |accessdate=1 August 2019}}</ref> Meanwhile, Roman Elizarov independently came upon the same ideas while developing an experimental coroutine library for the Kotlin language.<ref>{{cite web |last1=Elizarov |first1=Roman |title=Structured concurrency |url=https://medium.com/@elizarov/structured-concurrency-722d765aa952 |date=12 September 2018 |accessdate=21 September 2019}}</ref><ref>{{cite AV media |people=Elizarov, Roman |date=July 2019 |title=Structured concurrency |medium=Videotape |language=en |url=https://youtube.com/watch?v=Mj5P47F6nJg&t=2538 |access-date=21 September 2019 |publisher=Hydra Distributed computing conference |minutes=42 |quote="We needed a name and we needed to finalize this whole concept [...] and we stumble onto this blog post [...] by Nathaniel J. Smith."}}</ref>▼
▲== History ==
▲The [[fork–join model]] from the 1960s, embodied by multiprocessing tools like [[OpenMP]], is an early example of a system ensuring all threads have completed before exit. However, Smith argues that this model is not true structured concurrency as the programming language is unaware of the joining behavior, and is thus unable to enforce safety.<ref>{{cite
▲The concept was formulated in 2016 by Martin Sústrik (
In 2021, [[Swift (programming language)|Swift]] adopted structured concurrency.<ref>{{cite web |first1=John |last1=McCall |first2=Joe |last2=Groff |first3=Doug |last3=Gregor |first4=Konrad |last4=Malawski |access-date=3 March 2022 |title=Swift Structured Concurrency Proposal |website=Apple's Swift Evolution repo |publisher=GitHub |url=https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md}}</ref> Later that year, a draft proposal was published to add structured concurrency to [[Java (programming language)|Java]].<ref>{{cite web |last1=Pressler |first1=Ron |website=[[OpenJDK]] |publisher=Oracle |access-date=3 March 2022 |title=JEP draft: Structured Concurrency (Incubator) |url=https://openjdk.java.net/jeps/8277129}}</ref>
== Variations ==
Line 18 ⟶ 20:
== References ==
{{Reflist}}
* [https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ Notes on structured concurrency, or: Go statement considered harmful] by Nathaniel J. Smith
* [https://trio.discourse.group/c/structured-concurrency Structured concurrency forum], cross-computer-language discussion of structured concurrency with participation by Sústrik, Smith, and Elizarov
* [https://archive.fosdem.org/2019/schedule/event/structured_concurrency/ FOSDEM 2019: Structured Concurrency], lightning talk by Martin Sustrik with links to some implementations
▲{{Programming paradigms navbox}}
[[Category:Programming paradigms]]
|