Byte Depth
← All tags

#ReentrantLock

3 articles

Concurrency

Blocking Queue — Producer-Consumer

Implement a thread-safe bounded blocking queue from scratch using ReentrantLock and Condition variables — the canonical producer-consumer concurrency problem.

Aug 10, 2026
ConcurrencyJavaMultithreading

Concurrency

Dining Philosophers — Deadlock-Free Fork Ordering

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.

Aug 10, 2026
ConcurrencyJavaDeadlock

Concurrency

Print Zero-Odd-Even — Three-Thread Sequencing

Three threads must interleave to print '0102030405…' — zero before every number, odd and even alternating. Solved with ReentrantLock and three dedicated Condition variables.

Aug 10, 2026
ConcurrencyJavaMultithreading
© 2026 ByteDepth. All rights reserved.Built with care for curious engineers.