/sleeping-barber-problem

solve sleeping barber problem using golang

Primary LanguageGo

sleeping-barber-problem

The purpose of this exercise is to practice the usage of concurrency mechanisms in Go

Problem : The analogy is based upon a hypothetical barber shop with one barber. There is a barber shop which has one barber, one barber chair, and n chairs for waiting for customers if there are any to sit on the chair.

If there is no customer, then the barber sleeps in his own chair. When a customer arrives, he has to wake up the barber. If there are many customers and the barber is cutting a customer’s hair, then the remaining customers either wait if there are empty chairs in the waiting room or they leave if no chairs are empty.

Source: https://www.geeksforgeeks.org/sleeping-barber-problem-in-process-synchronization/