skip to main content
10.1145/3547276.3548519acmotherconferencesArticle/Chapter ViewAbstractPublication PagesicppConference Proceedingsconference-collections
research-article

Structured Concurrency: A Review

Authors Info & Claims
Published:13 January 2023Publication History

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.

References

  1. 2018. kotlinx.coroutines. Retrieved May 25, 2022 from https://github.com/Kotlin/kotlinx.coroutinesGoogle ScholarGoogle Scholar
  2. 2021. Debug coroutines using IntelliJ IDEA—tutorial. Retrieved May 25, 2022 from https://kotlinlang.org/docs/debug-coroutines-with-idea.htmlGoogle ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle Scholar
  5. Ole-Johan Dahl, Edsger Wybe Dijkstra, and Charles Antony Richard Hoare. 1972. Structured programming. Academic Press Ltd.Google ScholarGoogle Scholar
  6. Docs.rs. 2021. Function crossbeam::scope. Retrieved May 25, 2022 from https://docs.rs/crossbeam/0.8.1/crossbeam/fn.scope.htmlGoogle ScholarGoogle Scholar
  7. Docs.rs. 2021. Function rayon::scope. Retrieved May 25, 2022 from https://docs.rs/rayon/1.5.1/rayon/fn.scope.htmlGoogle ScholarGoogle Scholar
  8. Roman Elizarov. 2017. Introduction to Coroutines. Retrieved May 25, 2022 from https://www.youtube.com/watch?v=_hfBv0a09JcGoogle ScholarGoogle Scholar
  9. Roman Elizarov. 2018. Structured Concurrency. Retrieved May 25, 2022 from https://elizarov.medium.com/structured-concurrency-722d765aa952Google ScholarGoogle Scholar
  10. Benjamin Erb. 2012. Concurrent Programming for Scalable Web Architectures. Diploma Thesis. Institute of Distributed Systems, Ulm University. http://www.benjamin-erb.de/thesisGoogle ScholarGoogle Scholar
  11. R. Graham. 2013. The C10M problem. Retrieved May 25, 2022 from http://c10m.robertgraham.com/p/manifesto.htmlGoogle ScholarGoogle Scholar
  12. Anders Hejlsberg. 2010. Introducing Async—Simplifying Asynchronous Programming. Retrieved May 25, 2022 from https://channel9.msdn.com/Blogs/Charles/Anders-Hejlsberg-Introducing-AsyncGoogle ScholarGoogle Scholar
  13. Dan Kegel. 2006. The C10K problem. Retrieved May 25, 2022 from http://www.kegel.com/c10k.htmlGoogle ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Edward A Lee. 2006. The problem with threads. Computer 39, 5 (2006), 33–42.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Glyph Lefkowitz. 2014. Unyielding. Retrieved May 25, 2022 from https://glyph.twistedmatrix.com/2014/02/unyielding.htmlGoogle ScholarGoogle Scholar
  17. Linux man-pages contributors. 2005. pthreads—POSIX threads. Retrieved May 25, 2022 from https://man7.org/linux/man-pages/man7/pthreads.7.htmlGoogle ScholarGoogle Scholar
  18. 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 ScholarGoogle Scholar
  19. 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 ScholarGoogle Scholar
  20. 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 ScholarGoogle Scholar
  21. 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 ScholarGoogle Scholar
  22. 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 ScholarGoogle Scholar
  23. Nathaniel J. Smith. 2017. Trio Documentation—Spawning subprocesses. Retrieved May 25, 2022 from https://trio.readthedocs.io/en/stable/reference-io.html?#spawning-subprocessesGoogle ScholarGoogle Scholar
  24. 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 ScholarGoogle Scholar
  25. Martin Sústrik. 2013. The Callback Hell. Retrieved May 25, 2022 from https://250bpm.com/blog:24/index.htmlGoogle ScholarGoogle Scholar
  26. Martin Sústrik. 2013. Event-driven architecture, state machines et al.Retrieved May 25, 2022 from https://250bpm.com/blog:25/index.htmlGoogle ScholarGoogle Scholar
  27. Martin Sústrik. 2016. Getting rid of state machines (I). Retrieved May 25, 2022 from https://250bpm.com/blog:69/index.htmlGoogle ScholarGoogle Scholar
  28. Martin Sústrik. 2016. Getting rid of state machines (II). Retrieved May 25, 2022 from https://250bpm.com/blog:69/index.htmlGoogle ScholarGoogle Scholar
  29. Martin Sústrik. 2016. libdill. Retrieved May 25, 2022 from https://github.com/sustrik/libdillGoogle ScholarGoogle Scholar
  30. Martin Sústrik. 2016. Structured Concurrency. Retrieved May 25, 2022 from https://250bpm.com/blog:71/index.htmlGoogle ScholarGoogle Scholar
  31. The Go Authors. 2009. errgroup package. Retrieved May 25, 2022 from https://pkg.go.dev/golang.org/x/sync/errgroupGoogle ScholarGoogle Scholar
  32. The Tornado Authors. 2013. Tornado. Retrieved May 25, 2022 from https://github.com/tornadoweb/tornadoGoogle ScholarGoogle Scholar
  33. The Twisted Authors. 2022. Twisted. Retrieved May 25, 2022 from https://twistedmatrix.com/trac/Google ScholarGoogle Scholar
  34. 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 ScholarGoogle Scholar
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Structured Concurrency: A Review

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Other conferences
      ICPP Workshops '22: Workshop Proceedings of the 51st International Conference on Parallel Processing
      August 2022
      233 pages
      ISBN:9781450394451
      DOI:10.1145/3547276

      Copyright © 2022 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 13 January 2023

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article
      • Research
      • Refereed limited

      Acceptance Rates

      Overall Acceptance Rate91of313submissions,29%
    • Article Metrics

      • Downloads (Last 12 months)72
      • Downloads (Last 6 weeks)3

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    HTML Format

    View this article in HTML Format .

    View HTML Format