Question: The sleepy Barber problem [Dijkstra, 1968]. A barbershop is designed so that there is a private room that contains the barber chair and an adjoining
The sleepy Barber problem [Dijkstra, 1968]. A barbershop is designed so that there is a private room that contains the barber chair and an adjoining waiting room with a sliding door that contains N chairs (see Figure). If the barber is busy, the door to the private room is closed and arriving customers sit in one of the available chairs. If a customer enters the shop and all chairs are occupied, the customer leaves the shop without a haircut. If there are no customers to be served, the barber goes to sleep in the barber chair with the door to the waiting room open. If the barber is asleep, the customer wakes the barber and obtains a haircut. Write code fragments to define synchronization schemes for the customers and the barber.

Entrance to Waiting Room (sliding door) Shop Exit Entrance to Barber's Room (sliding door) Waiting Room
Step by Step Solution
3.35 Rating (164 Votes )
There are 3 Steps involved in it
As Dijkstra points out this is just a restatement of the producerconsumer ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
34-E-CE-OS (457).docx
120 KBs Word File
