Search code examples
javajava-19structured-concurrency

What is Structured Concurrency?


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?


Solution

  • 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.