The sleepy Barber problem [Dijkstra, 1968]. A barbershop is designed so that there is a private room

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 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.

image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: