ABSTRACT
Today, mobile applications use thousands of concurrent tasks to process multiple sensor inputs to ensure a better user experience. With this demand, the ability to manage these concurrent tasks efficiently and easily is becoming a new challenge, especially in their lifetimes. Structured concurrency is a technique that reduces the complexity of managing a large number of concurrent tasks. There have been several languages or libraries (e.g., Kotlin, Swift, and Trio) that support such a paradigm for better concurrency management. It is worth noting that structured concurrency has been consistently implemented on top of coroutines across all these languages and libraries. However, there are no documents or studies in the literature that indicate why and how coroutines are relevant to structured concurrency. In contrast, the mainstream community views structured concurrency as a successor to structured programming; that is, the concept of “structure” extends from ordinary programming to concurrent programming. Nevertheless, such a viewpoint does not explain, as the concept of structured concurrency came out more than 40 years later after structured programming was introduced in the early 1970s, whereas concurrent programming started in the 1960s. In this paper, we introduce a new theory to complement the origin of structured concurrency from historical and technical perspectives—it is the foundation established by coroutines that gives birth to structured concurrency.
- 2018. kotlinx.coroutines. Retrieved May 25, 2022 from https://github.com/Kotlin/kotlinx.coroutinesGoogle Scholar
- 2021. Debug coroutines using IntelliJ IDEA—tutorial. Retrieved May 25, 2022 from https://kotlinlang.org/docs/debug-coroutines-with-idea.htmlGoogle Scholar
- Atul Adya, Jon Howell, Marvin Theimer, William J. Bolosky, and John R. Douceur. 2002. Cooperative Task Management Without Manual Stack Management. In Proceedings of the General Track of the Annual Conference on USENIX Annual Technical Conference(ATEC ’02). USENIX Association, USA, 289–302.Google ScholarDigital Library
- John Belmonte. 2018. “Concurrency made easy”: coming soon to a programming language near you. Retrieved May 25, 2022 from https://medium.com/@belm0/concurrency-made-easy-d3fdb0382c58Google Scholar
- Ole-Johan Dahl, Edsger Wybe Dijkstra, and Charles Antony Richard Hoare. 1972. Structured programming. Academic Press Ltd.Google Scholar
- Docs.rs. 2021. Function crossbeam::scope. Retrieved May 25, 2022 from https://docs.rs/crossbeam/0.8.1/crossbeam/fn.scope.htmlGoogle Scholar
- Docs.rs. 2021. Function rayon::scope. Retrieved May 25, 2022 from https://docs.rs/rayon/1.5.1/rayon/fn.scope.htmlGoogle Scholar
- Roman Elizarov. 2017. Introduction to Coroutines. Retrieved May 25, 2022 from https://www.youtube.com/watch?v=_hfBv0a09JcGoogle Scholar
- Roman Elizarov. 2018. Structured Concurrency. Retrieved May 25, 2022 from https://elizarov.medium.com/structured-concurrency-722d765aa952Google Scholar
- Benjamin Erb. 2012. Concurrent Programming for Scalable Web Architectures. Diploma Thesis. Institute of Distributed Systems, Ulm University. http://www.benjamin-erb.de/thesisGoogle Scholar
- R. Graham. 2013. The C10M problem. Retrieved May 25, 2022 from http://c10m.robertgraham.com/p/manifesto.htmlGoogle Scholar
- Anders Hejlsberg. 2010. Introducing Async—Simplifying Asynchronous Programming. Retrieved May 25, 2022 from https://channel9.msdn.com/Blogs/Charles/Anders-Hejlsberg-Introducing-AsyncGoogle Scholar
- Dan Kegel. 2006. The C10K problem. Retrieved May 25, 2022 from http://www.kegel.com/c10k.htmlGoogle Scholar
- Hugh C Lauer and Roger M Needham. 1979. On the duality of operating system structures. ACM SIGOPS Operating Systems Review 13, 2 (1979), 3–19.Google ScholarDigital Library
- Edward A Lee. 2006. The problem with threads. Computer 39, 5 (2006), 33–42.Google ScholarDigital Library
- Glyph Lefkowitz. 2014. Unyielding. Retrieved May 25, 2022 from https://glyph.twistedmatrix.com/2014/02/unyielding.htmlGoogle Scholar
- Linux man-pages contributors. 2005. pthreads—POSIX threads. Retrieved May 25, 2022 from https://man7.org/linux/man-pages/man7/pthreads.7.htmlGoogle Scholar
- Eric Lippert. 2011. Asynchronous Programming—Easier Asynchronous Programming with the New Visual Studio Async CTP. Retrieved May 25, 2022 from https://docs.microsoft.com/en-us/archive/msdn-magazine/2011/october/asynchronous-programming-easier-asynchronous-programming-with-the-new-visual-studio-async-ctpGoogle Scholar
- John McCall, Joe Groff, Doug Gregor, and Konrad Malawski. 2021. Structured Concurrency. Retrieved May 25, 2022 from https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.mdGoogle Scholar
- John Ousterhout. 1996. Why threads are a bad idea (for most purposes). In Presentation given at the 1996 Usenix Annual Technical Conference, Vol. 5. San Diego, CA, USA.Google Scholar
- Nathaniel J. Smith. 2017. Trio—a friendly Python library for async concurrency and I/O. Retrieved May 25, 2022 from https://github.com/python-trio/trioGoogle Scholar
- Nathaniel J. Smith. 2017. Trio Documentation—Debugging and instrumentation. Retrieved May 25, 2022 from https://trio.readthedocs.io/en/stable/reference-lowlevel.html#debugging-and-instrumentationGoogle Scholar
- Nathaniel J. Smith. 2017. Trio Documentation—Spawning subprocesses. Retrieved May 25, 2022 from https://trio.readthedocs.io/en/stable/reference-io.html?#spawning-subprocessesGoogle Scholar
- Nathaniel J. Smith. 2018. Notes on structured concurrency, or: Go statement considered harmful. Retrieved May 25, 2022 from https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/Google Scholar
- Martin Sústrik. 2013. The Callback Hell. Retrieved May 25, 2022 from https://250bpm.com/blog:24/index.htmlGoogle Scholar
- Martin Sústrik. 2013. Event-driven architecture, state machines et al.Retrieved May 25, 2022 from https://250bpm.com/blog:25/index.htmlGoogle Scholar
- Martin Sústrik. 2016. Getting rid of state machines (I). Retrieved May 25, 2022 from https://250bpm.com/blog:69/index.htmlGoogle Scholar
- Martin Sústrik. 2016. Getting rid of state machines (II). Retrieved May 25, 2022 from https://250bpm.com/blog:69/index.htmlGoogle Scholar
- Martin Sústrik. 2016. libdill. Retrieved May 25, 2022 from https://github.com/sustrik/libdillGoogle Scholar
- Martin Sústrik. 2016. Structured Concurrency. Retrieved May 25, 2022 from https://250bpm.com/blog:71/index.htmlGoogle Scholar
- The Go Authors. 2009. errgroup package. Retrieved May 25, 2022 from https://pkg.go.dev/golang.org/x/sync/errgroupGoogle Scholar
- The Tornado Authors. 2013. Tornado. Retrieved May 25, 2022 from https://github.com/tornadoweb/tornadoGoogle Scholar
- The Twisted Authors. 2022. Twisted. Retrieved May 25, 2022 from https://twistedmatrix.com/trac/Google Scholar
- J Robert Von Behren, Jeremy Condit, and Eric A Brewer. 2003. Why Events Are a Bad Idea (for High-Concurrency Servers). In Proceedings of HotOS. 19–24.Google Scholar
- Rob Von Behren, Jeremy Condit, Feng Zhou, George C Necula, and Eric Brewer. 2003. Capriccio: scalable threads for internet services. ACM SIGOPS Operating Systems Review 37, 5 (2003), 268–281.Google ScholarDigital Library
- Matt Welsh, David Culler, and Eric Brewer. 2001. SEDA: An architecture for well-conditioned, scalable internet services. ACM SIGOPS operating systems review 35, 5 (2001), 230–243.Google ScholarDigital Library
Index Terms
- Structured Concurrency: A Review
Recommendations
Contention in Structured Concurrency: Provably Efficient Dynamic Non-Zero Indicators for Nested Parallelism
PPoPP '17: Proceedings of the 22nd ACM SIGPLAN Symposium on Principles and Practice of Parallel ProgrammingOver the past two decades, many concurrent data structures have been designed and implemented. Nearly all such work analyzes concurrent data structures empirically, omitting asymptotic bounds on their efficiency, partly because of the complexity of the ...
Contention in Structured Concurrency: Provably Efficient Dynamic Non-Zero Indicators for Nested Parallelism
PPoPP '17Over the past two decades, many concurrent data structures have been designed and implemented. Nearly all such work analyzes concurrent data structures empirically, omitting asymptotic bounds on their efficiency, partly because of the complexity of the ...
Comments