This is a demonstration of a relatively simple producer-consumer system. It also shows an interactive demo.
The producers generate items and store them in the buffer. The consumers fetch the items from the buffer and process them. Each actor (producers, consumers) are independent threads. Each of them tries to produce as much as possible, consume as much as possible respectively.