If there is a free chair in the waiting room, the customer sits in it and waits their turn. If the barber is cutting hair, the customer stays in the waiting room. If the barber is sleeping, the customer wakes him up and sits in the cutting room chair. If there are none, he returns to the chair and sleeps in it.Įach customer, when they arrive, looks to see what the barber is doing. If there are, he brings one of them back to the chair and cuts their hair. When the barber finishes cutting a customer's hair, he dismisses the customer and goes to the waiting room to see if there are others waiting. The barber has one barber's chair in a cutting room and a waiting room containing a number of chairs in it. The analogy is based upon a hypothetical barber shop with one barber. The problem is analogous to that of keeping a barber working when there are customers, resting when there are none, and doing so in an orderly manner. " In computer science, the sleeping barber problem is a classic inter-process communication and synchronization problem between multiple operating system processes. number of customers that were forced to leave.The popular sleeping barber problem, implemented with pthreads, semaphores and mutexes in C.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |