Problems
Use the following problems to test your programming prowess in virtual threads and structured concurrency in Java. I strongly encourage you to give each problem a try before you turn to the solutions and download the example programs:
- Explaining concurrency vs. parallelism: Provide a brief but meaningful explanation of concurrency vs. parallelism.
- Introducing structured concurrency: Write an example highlighting the main issues of “unstructured” concurrency. Moreover, provide an introduction to the structured concurrency paradigm.
- Introducing virtual threads: Explain and exemplify the main concepts of virtual threads.
- Using the ExecutorService for virtual threads: Write several examples that highlight the task-per-thread model via
ExecutorService
and virtual threads. - Explaining how virtual threads work: Provide comprehensive coverage of how virtual threads work internally.
- Hooking virtual threads and sync code: Explain...