Learning journey through modern Java concurrency, based on:
- Java Concurrency in Practice — Brian Goetz et al.
- Modern Concurrency in Java — A N M Bazlur Rahman
- Java Structured Concurrency — Anghel Leonard
- Understanding Java Virtual Threads — Fu Cheng
docs/ → Markdown notes (migrating to Astro later)
docs/images/ → Mermaid diagrams (PNG)
src/ → Code examples and demos
exercises/ → Self-test questions per chapter
| Chapter | Source | Doc |
|---|---|---|
| Ch. 3 — Sharing Objects | JCiP | docs/chapter-iii-shared-objects.md |
| Ch. 16 — The Java Memory Model | JCiP | docs/chapter-xvi-the-java-memory-model.md |
| File | Topic |
|---|---|
| GuardedObjectExample | Guarded-by pattern |
| ThreadLocalDemo | ThreadLocal usage and cleanup |
| SharedThreadSafeExample | Thread-safe shared state |
| ImmutableUser | Immutability with defensive copies |
| TryLockRetryExample | tryLock with random backoff |
| ThreadConfinedExample | Thread confinement |
| SharedReadOnlyExample | Read-only shared data |
| File | Topic |
|---|---|
| VolatilePiggybackDemo | Piggybacking visibility on volatile |
| SafePublicationDemo | 4 safe publication idioms |
| UnsafePublicationDemo | Broken singleton + 3 fixes |
Self-test questions organized by chapter — see exercises/README.md.
| Chapter | Questions | Topics |
|---|---|---|
| Ch. III — Shared Objects | 8 | Publication/escape, ThreadLocal, deadlock/livelock |
| Ch. XVI — Java Memory Model | 9 | Piggybacking, safe publication, happens-before, join() |
| Diagram | Topic |
|---|---|
| happens-before-visibility | Happens-before visibility between threads |
| join-happens-before-chain | join() happens-before chain (Writer → Main → Reader) |
| join-does-not-order-threads | join() does NOT order threads relative to each other |
| join-as-happens-before | join() as a happens-before edge |
| join-vs-safe-publication | join() vs safe publication mechanisms |
| static-initializer-vs-static-method | static final (class loading) vs static method (no sync) |
| trylock-retry-sequence | tryLock retry with random backoff sequence |
- Java Concurrency in Practice (JCiP)
- Ch. 3: Sharing Objects
- Ch. 16: The Java Memory Model
- Modern Concurrency in Java (Bazlur Rahman)
- Ch. 4: Virtual Threads ← start here (practical "what and how")
- Ch. 7: Carrier Thread Pinning ← read after Fu Cheng (makes mechanical sense)
- Understanding Java Virtual Threads (Fu Cheng)
- The Scheduler & Continuations ← read between Ch.4 and Ch.7 (the "why")
- Java Structured Concurrency (Anghel Leonard)
- Ch. 2: StructuredTaskScope
- Ch. 5: Scoped Values