notesonly.in

One notebook for every subject — open it anywhere.

Log in

Process synchronization and semaphores

Operating Systems · Engineering

Study notes

Producer-consumer with a 10-slot buffer: empty=10, full=0, mutex=1. Producer: wait(empty), wait(mutex), add item, signal(mutex), signal(full). Consumer mirrors. Semaphores count available slots so producers block when full and consumers when empty; the mutex serializes buffer access. Remove any wait and races corrupt the buffer.

← Back to topics for Engineering