Professional Documents
Culture Documents
Only one process can use at a time.A mutex provides mutual exclusion, either producer or
consumer can have the key (mutex) and proceed with their work.
Produce
do{
//produce an item
wait(empty);
wait(mutex);
//place in buffer
signal(mutex);
signal(full);
}while(true)
CONSUME:
do{
wait(full);
wait(mutex);
signal(mutex);
signal(empty);
// consumes item
}while(true)
*****************************SOLVE IT****************************************************