A barber shop has an entrance from where the customers enter to have a haircut. Inside there are a set of X barbers who cut the hair of customer one at a time and if there are no customers he sleeps in his chair. If customer arrives and finds the barber asleeps then he goes to the waiting room checks if seats are available he goes and sits on the chair otherwise exits the shop.
This program has been modidfed for multiple barbers with mutli core implementation from the multi threaded solution for one barber. The source code is referenced from https://orajavasolutions.wordpress.com/tag/sleeping-barber-problem/ This site contains the implementation of sleeping barber problem using wait() and notify() which is fairly easy to understand. Also I have included few resources which shows different types of solutions to the sleeping barber problem, you can check them out below.
https://orajavasolutions.wordpress.com/tag/sleeping-barber-problem/ https://www.cs.helsinki.fi/u/kerola/rio/ohjeet/Java/semaphores/s06e-huhtamaki-merikanto-nevalainen/SleepingBarber.java https://javaexplorer03.blogspot.com/2016/05/sleeping-barber-problem.html https://njavatech.blogspot.com/2014/03/sleeping-barber-problem-using-reentrant.html https://www.geeksforgeeks.org/sleeping-barber-problem-in-process-synchronization/ https://github.com/ylegat/sleeping-barber/blob/master/src/exercise/Main.java https://massivetechinterview.blogspot.com/2015/08/sleeping-barber-problem-oracle-java.html https://njavatech.blogspot.com/2014/03/sleeping-barber-problem-using-semaphores.html https://github.com/MikeChristianson/sleeping-barber/tree/master/src/name/christianson/mike https://vyatkins.wordpress.com/2013/12/21/sleeping-barber-problem/