Structured concurrency: Difference between revisions

Content deleted Content added
Updated link for Java proposal and references.
Line 9:
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 name=smith/>
 
The concept was formulated in 2016 by Martin Sústrik (creator of [[ZeroMQ]]) with his C library libdill, with [[Go_(programming_language)#Concurrency:_goroutines_and_channels|goroutines]] as a starting point.<ref>{{cite web |last1=Sústrik |first1=Martin |title=Structured Concurrency |url=http://250bpm.com/blog:71 |date=7 February 2016 |accessdateaccess-date=1 August 2019}}</ref> It was further refined in 2018 by Nathaniel J. Smith, who introduced a "nursery pattern" in his [[Python (programming language)|Python]] implementation 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 |accessdateaccess-date=1 August 2019}}</ref> Meanwhile, Roman Elizarov independently came upon the same ideas while developing an experimental [[coroutine]] library for the [[Kotlin (programming language)|Kotlin language]].,<ref>{{cite web |last1=Elizarov |first1=Roman |title=Structured concurrency |url=https://medium.com/@elizarov/structured-concurrency-722d765aa952 |date=12 September 2018 |accessdateaccess-date=21 September 2019}}</ref><ref>{{cite AV media |people=Elizarov, Roman |date=11 July 2019 |title=Structured concurrency |medium=VideotapeVideo |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> which later became a standard library.<ref>{{cite web | url=https://kotlinlang.org/docs/coroutines-basics.html#structured-concurrency | title=Coroutines basics: Structured concurrency | website=Kotlin | publisher=JetBrains | access-date=3 March 2022}}</ref>
 
In 20192021, the loom project from [[OpenJDKSwift (programming language)|Swift]] is adoptingadopted structured concurrency.<ref>{{cite toweb bring|first1=John it|last1=McCall to|first2=Joe the|last2=Groff [[Java|first3=Doug platform]]|last3=Gregor in|first4=Konrad a|last4=Malawski future|access-date=3 releaseMarch as2022 part|title=Swift ofStructured 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 largerdraft workproposal onwas [[lightweightpublished thread]]sto andadd structured concurrency to [[coroutineJava (programming language)|Java]]s.<ref>{{cite web |last1=BatemanPressler |first1=AlanRon |website=openjdk.java.net |publisher=[[OpenJDK]] |publisher=Oracle |access-date=November3 23,March 20192022 |title=JEP draft: Structured concurrencyConcurrency (Incubator) |url=https://wiki.openjdk.java.net/displayjeps/loom/Structured+Concurrency8277129}}</ref>
 
In 2021, [[Swift (programming language)|Swift]] adopted structured concurrency.<ref>{{cite web |last1=Cohen |first1=Ben |website=swift.org |publisher=[[Swift (programming language)|Swift]] |access-date=October 31, 2020|title=Swift Structured Concurrency Proposal |url=https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md}}</ref>
 
== Variations ==
Line 22 ⟶ 20:
 
== References ==
=== Citations ===
{{Reflist}}
 
=== External links===
* [https://wiki.openjdk.java.net/display/loom/Structured+Concurrency Structured Concurrency], Alan Bateman, [[OpenJDK]] wiki
* [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