JMM, Visibility & Atomicity

Can you spot the race? Practice 5 scenarios in this Java concurrency topic.

Drills in this section

  • Lost Update on a Shared Counter: Lost Update on a Shared Counter: practice a Java concurrency bug with symptoms like Undercounted metric, No exception, Flaky result. Inspect runnable...
  • Broken AtomicLong Watermark Update: Broken AtomicLong Watermark Update: practice a Java concurrency bug with symptoms like Watermark moves backward, Atomic field still wrong, No exception....
  • Check-Then-Act Race in an Idempotency Guard: Check-Then-Act Race in an Idempotency Guard: practice a Java concurrency bug with symptoms like Duplicate side effect, Thread-safe collection still...
  • Stop Flag Without volatile: Stop Flag Without volatile: practice a Java concurrency bug with symptoms like Worker never stops, Process still alive, Flaky behavior. Inspect runnable...
  • Racy Lazy Initialization with Side Effects: Racy Lazy Initialization with Side Effects: practice a Java concurrency bug with symptoms like Rare inconsistent behavior, Flaky initialization,...