Skip to content

What is Structured concurrency

Devrath edited this page Jan 12, 2024 · 12 revisions

Basic meaning of concurrency

Structured concurrency is a way of executing the concurrent code so that proper management of resources and the flow of control is done.

In the context of co-routines

In co-routines, provides some rules for managing the concurrency and execution of concurrent tasks in a controlled and disciplined manner.

Challenges faced by other approaches to concurrency

In traditional concurrency models such as threads or callback-based systems, It is challenging to manage the lifecycle of concurrent tasks -> Structured concurrency addresses this by a properly structured and hierarchical approach to manage it.

Basic Idea

Create a scope and launch the co-routines within the scope so that when the scope is canceled, all the co-routines in it are canceled.

Clone this wiki locally