What is Structured Concurrency?

119 Views Asked by At

This is a sort-of terminology question. One of the features of Java 19 is "Structured Concurrency". Why is that so-named? is it because the asynchronous code is not truly parallel? We are lead to believe that these fibers or virtual threads are like threads, in that they can be oblivious of other threads. Why, then, is it not structured Parallelism?

2

There are 2 best solutions below

0
Naman On BEST ANSWER

The JEP-428 which included this as an Incubator has an answer that could help relate:

Structured concurrency is an approach to multithreaded programming that preserves the readability, maintainability, and observability of single-threaded code. It embodies the principle that

If a task splits into concurrent subtasks then they all return to the same place, namely the task's code block.

0
HellishHeat On

I feel as though I've stumbled on the meaning. A large task is completed in a structured way, by lots of parallel fibers, working concurrently.