Producer Consumer Problem
Problem Statement
Solution
do {
wait( empty ); // wait until empty > 0 then , empty->val--
wait( mutex ); // wait until we don't lock on buffer
// Start critical section
producer()
// End Critical Section
signal( mutex ); // release lock on the buffer and notify all
signal( full ); // increment the value of full , full->val++
} while ( True );Last updated