layout: category_index title: “Virtual Threads & Loom” description: “Master Project Loom, Virtual Threads, Structured Concurrency, and Scoped Values. Learn how to write high-throughput concurrent Java applications.” category: “03 Virtual Threads” permalink: /java/03-virtual-threads/ order: 3 toc: true

keywords: [Jules, Technical Documentation]—

Virtual Threads & Loom

Project Loom is the biggest change to Java concurrency in 20 years. It introduces lightweight Virtual Threads (JEP 444), allowing you to run millions of threads with minimal memory overhead. Along with Structured Concurrency (JEP 453) and Scoped Values (JEP 446), it completely redefines how we write scalable backend applications.

Module Contents

1. Project Loom Intro

Understand the M:N scheduling model, the difference between Platform and Virtual threads, and why blocking is now “cheap”.

  • Visualizer: The Loom Scheduler (Mounting/Unmounting)

2. Structured Concurrency

Stop treating threads as “fire and forget”. Learn to use StructuredTaskScope to treat a group of subtasks as a single unit of work with automatic cancellation and error propagation.

  • Visualizer: Scope Failure Propagation

3. Scoped Values

A modern alternative to ThreadLocal. Share immutable data (like User IDs or Transaction Contexts) through the call stack safely and efficiently.

  • Visualizer: Scoped Stack Bindings

Review & Cheat Sheet

Test your knowledge with flashcards and get quick copy-paste code snippets for your projects.