The Producer-Counsumer Problem may seem to be similar to Reader-Writer Problem but it not so, both the examples of multi-process synchronization problem and about resource sharing.
To make sure that the producer won't try to append the data into buffer if it is full and that the consumer won't try to remove data from an empty buffer. Producer can't produce data when consumer is consuming and vice-versa.
The producer is to either go to sleep or discard data if the buffer is full. The next time the consumer removes an item from the buffer, it notifies the producer, who starts to fill the buffer again. In the same way, the consumer can go to sleep if it finds the buffer to be empty. The next time the producer puts data into the buffer, it wakes up the sleeping consumer. An inadequate solution could result in a deadlock where both processes are waiting to be awakened.