Byte Depth
← All tags

#Wait-Notify

2 articles

Concurrency

Print FooBar Alternately — Two Approaches

Two threads must alternate printing 'foo' and 'bar' exactly n times each. Compare a synchronized wait/notify approach against a cleaner paired-semaphore solution.

Aug 10, 2026
ConcurrencyJavaMultithreading

Concurrency

Round Robin Print — N Threads in Order

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.

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