The producer/consumer problem with bounded buffer:
- producer thread repeatedly inserts items in a queue (bounded buffer) which can hold at most N items
- consumer thread repeatedly removes items from the queue
Requirements
- Mutual exclusion is required for remove and insert
- Synchronization is required for the producer: must wait if the buffer is full.
- Synchronization is required for the consumer: must wait if the buffer is empty.