See DiningPhilosophersChallenge, UnitTestsForSynchronizationLogic, UnitTestingNonDeterministicCode, ThreadTests