The problem was originally proposed in 1965 by computer science pioneer Edsger Dijkstra.
- A barber goes to work in a barbershop with a waiting room with a fixed number of seats.
- If no one is in the waiting room, the barber goes to sleep.
- When a client shows up, if there are no seats available, he or she leaves.
- If there is a seat available, and the barber is sleeping, the client wakes the barber up and gets a hair cut.
- If the barber is busy, the client takes a seat and waits his or her turn.
- Once the shop closes, no more clients are allowed in, but the barber has to stay until everyone who is waiting gets a hair cut.
The point of this problem, and its solution, was to make it clear that in a lot of cases, the use of semaphores (mutexes) is not needed.