NetLogo User Community Models
by Katerina Seifarthova (Submitted: 10/18/2009)
WHAT IS IT?
The Sleeping Barber Problem (or Barbershop Problem) is a synchronization problem which was first proposed by Edsger W. Dijkstra in 1968.
A barbershop usually consists of a waiting room with several chairs and the barber room containing the barber chair. Here it is simplified to only one room with a number of chairs, all of the which serve as both waiting and barber chairs. When a customer enters the shop to be served, if the shop is full, he leaves without being served.
HOW IT WORKS
There are two types of agents: the barber, who serves the customers, and the customers themselves.
HOW TO USE IT
Initial settings - by default :
THINGS TO NOTICE
Observe the line chart and the number of processed/rejected customers, when modifying probability_of_entrance and probability_of_exit.
THINGS TO TRY
Play with the settings of the the sliders to change the probability of entrance or exit.
EXTENDING THE MODEL
There exists several versions of this problem. One modification could be to add more than one barber.
Related model from the NetLogo library: Computer Science - Dining Philosophers
CREDITS AND REFERENCES
E. W. Dijkstra, "Co-operating Sequential Processes", in F. Genuys (ed.), Programming Languages, Academic Press, 1968, pp. 43-112.
(back to the NetLogo User Community Models)