Adds JMH put/get throughput benchmarks (synchronizedMap vs ConcurrentHashMap,
swept at 1/2/4/8 threads), a computeIfAbsent recursion trap demo (CHM tolerates
recursion into a different key but throws IllegalStateException on the same
key; plain HashMap throws ConcurrentModificationException even single-threaded),
and a null-handling demo (CHM rejects null keys/values on put() and null keys
on get() too). 7/7 JUnit tests pass; all output/ transcripts captured from
real runs.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
Silent int/long overflow reproduced with real numbers, the Math *Exact()
family (addExact/subtractExact/multiplyExact/incrementExact/decrementExact/
negateExact/toIntExact/absExact) with the abs(MIN_VALUE) trap absExact
exists to catch, widening to long vs BigInteger, and the XOR-based overflow
bit trick Math.addExact uses internally, cross-checked against BigInteger
ground truth over 100k random int pairs per JUnit repeat.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
Adds the concurrency-interview module: a real race condition with its
actual lost-update count, why volatile alone doesn't fix it, a real
JVM-detected deadlock (ThreadMXBean.findDeadlockedThreads()) with the
fix, and ScopedValue's exact child-thread inheritance rules (finalized
in JDK 25 via JEP 506, demonstrated against StructuredTaskScope, still
preview per JEP 505/525). 4 runnable demos, 1 JUnit test class (9
tests), 5 captured output transcripts.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
Adds the executors module: shutdown() vs shutdownNow(), the graceful
two-phase shutdown pattern, AutoCloseable/try-with-resources (JDK 19+),
newVirtualThreadPerTaskExecutor() timing vs a bounded pool, and the
submit()-without-get() lost-exception trap. 5 runnable demos, 1 JUnit
correctness test class (23 tests), 6 captured output transcripts.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
One three-round worker pipeline implemented with CountDownLatch (one latch
per round), CyclicBarrier (reusable, with a barrier action), and Phaser
(reusable, plus dynamic mid-run registration), alongside Semaphore solving
the genuinely different problem of bounding concurrent access. Covers
timeout behavior (CyclicBarrier permanently breaks on one timeout, Phaser
doesn't) and virtual-thread compatibility, including the corrected finding
that Object.wait() releases its monitor and never pinned, unlike
Thread.sleep() inside synchronized.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
Reproduces the pinning JEP 491 did not fix (native JNI frames) with a real
native library, alongside the monitor case it did fix. Covers the
jdk.VirtualThreadPinned JFR event, reading pinned vs unmounted virtual
threads from a jcmd Thread.dump_to_file, the measured throughput cost on a
capped carrier pool, and a bounded-executor pattern to contain the blast
radius.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
AtomicLong/LongAdder/VarHandle counters benchmarked against the synchronized
and ReentrantLock baselines from the locks module, a deterministic ABA race
against a hand-rolled Treiber stack plus the AtomicStampedReference fix, and
a VarHandle access-modes demo (plain/opaque/acquire-release/volatile).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FhzLY5p6okFva3qsnsRyvM
JMH throughput sweep (1-64 threads), 9:1 read-heavy @Group benchmark,
tryLock(timeout) deadlock-avoidance demo, and a JDK21-vs-JDK25 JEP 491
virtual-thread-pinning comparison. Also promotes LICENSE to repo root
now that a second module exists.