The producer consumer problem is a classic synchronization problem. The producer generates items that are consumed by the consumer. When the producer and consumer run on the same machine, they share a common buffer where items are placed by the producer and retrieved by the consumer. When the processes execute on different machines they have to communicate via message passing through a network. Messages sent by the producer to the consumer are stored in the consumer's input buffer until they are consumed. Since the buffer has finite length (8 slots in our example), the producer should not send any more messages when the consumer's buffer is full. For that purpose, the producer will only send a message to the consumer when it receives an empty message (a container) from the consumer.By restricting the number of containers to eight (the size of the consumer's input buffer) we guarantee that the producer will not send more messages than can be stored by the consumer. The following important conditions have to be satisfied by the producer and consumer: