Add multithreading module: odd-even, ping-pong, ordered threads, deadlock detection and fixes, virtual-thread variants (25 tests)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
Claude
2026-10-28 18:10:23 +00:00
parent f80e1079a8
commit 94306c50ab
29 changed files with 1021 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
PASS DeadlockTest.naiveLockingDeadlocksAndTheJvmSaysSo
PASS DeadlockTest.consistentLockOrderingRemovesTheCycle
PASS DeadlockTest.fixesAlsoWorkOnVirtualThreads
PASS DeadlockTest.tryLockWithBackOffTurnsDeadlockIntoCountedRetries
PASS DeadlockTest.deadlockedVirtualThreadsAreInvisibleToFindDeadlockedThreads
PASS OddEvenTest.everyImplementationPrintsExactlyOneToTwentyInOrder(ThreadKind)[1]
PASS OddEvenTest.everyImplementationPrintsExactlyOneToTwentyInOrder(ThreadKind)[2]
PASS OddEvenTest.twoDifferentThreadsDoTheWork(ThreadKind)[1]
PASS OddEvenTest.twoDifferentThreadsDoTheWork(ThreadKind)[2]
PASS OddEvenTest.stableAcrossManyRunsAndOddMax(ThreadKind)[1]
PASS OddEvenTest.stableAcrossManyRunsAndOddMax(ThreadKind)[2]
PASS OddEvenTest.zeroAndOneAreHandled(ThreadKind)[1]
PASS OddEvenTest.zeroAndOneAreHandled(ThreadKind)[2]
PASS OrderedThreadsTest.roundRobinOfThreeThreadsPrintsOneToTen(ThreadKind)[1]
PASS OrderedThreadsTest.roundRobinOfThreeThreadsPrintsOneToTen(ThreadKind)[2]
PASS OrderedThreadsTest.latchesRunT1T2T3EvenThoughT3StartsFirst(ThreadKind)[1]
PASS OrderedThreadsTest.latchesRunT1T2T3EvenThoughT3StartsFirst(ThreadKind)[2]
PASS OrderedThreadsTest.thousandVirtualThreadsStillPrintInOrder
PASS OrderedThreadsTest.joinChainRunsT1T2T3(ThreadKind)[1]
PASS OrderedThreadsTest.joinChainRunsT1T2T3(ThreadKind)[2]
PASS PingPongTest.zeroRoundsPrintNothing(ThreadKind)[1]
PASS PingPongTest.zeroRoundsPrintNothing(ThreadKind)[2]
PASS PingPongTest.alternatesStrictlyForGivenRounds(ThreadKind)[1]
PASS PingPongTest.alternatesStrictlyForGivenRounds(ThreadKind)[2]
PASS SingleCarrierVirtualThreadTest.waitNotifyFinishesOnOneCarrierThread
25 tests, 0 failures