A barbershop consists of a waiting room with N chairs and the barber room containing the barber chairs. 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 (without waiting for service). If the barber is busy but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber.  Each customer and barber are different threads. Semaphores are used. Priority amongst customers is also incorporated. Let us say that there are two groups: staff and student. A waiting student customer has priority over the waiting staff customer (because the students are supposed to be busy !!!). Therefore, a barber attends to the waiting student customer after finishing the work on present customer. The program runs both with priority and without priority. In priority approach starvation is avoided by enforcing the condition of “each staff can allow maximum of 5 students to overtake”.