Concurrency
Implement a thread-safe bounded blocking queue from scratch using ReentrantLock and Condition variables — the canonical producer-consumer concurrency problem.
Coordinate hydrogen and oxygen threads so they always form complete H2O molecules — never a stray atom — using two semaphores to enforce stoichiometry and a CyclicBarrier to synchronize the triplet.
Five philosophers, five forks, one circular table — eliminate the circular wait that causes deadlock by acquiring forks in a fixed global index order, never left-before-right.
Two threads must alternate printing 'foo' and 'bar' exactly n times each. Compare a synchronized wait/notify approach against a cleaner paired-semaphore solution.
Three threads must print 'first', 'second', 'third' in order, regardless of scheduling. Compare CountDownLatch (clean one-shot signaling) against synchronized wait/notify (general state machine).
N threads must print a shared counter in strict round-robin order: thread 0 prints 1, thread 1 prints 2, …, wrapping back to thread 0, until maxCount is reached.
Three threads must interleave to print '0102030405…' — zero before every number, odd and even alternating. Solved with ReentrantLock and three dedicated Condition variables.