Barber Shop
Explore the Barber Shop concurrency problem by learning how to manage customer queues, barber sleeping states, and thread synchronization with semaphores and locks in Python. Understand thread communication, waiting conditions, and resource allocation to implement a solution that models real-world concurrency challenges.
We'll cover the following...
Barber Shop
A similar problem appears in Silberschatz and Galvin's OS book, and variations of this problem exist in the wild.
A barbershop consists of a waiting room with n chairs, and a barber chair for giving haircuts. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy, but chairs are available, then ...