Tutorial on How to Implement Producer-Consumer Pattern Using Wait and Notify Methods
Producer-consumer is a classic concurrent programming design pattern, where processes are designated as either producers or consumers. The producers are responsible for adding to some shared resource and the consumers are responsible for removing from that resource. Resource accessed by producer or consumer must be thread-safe. In other words, either a single producer or a single consumer can access the structure at any given time.