In practice, there are a number of problems that can occur that are illustrative of general scheduling problems. If there is no free chair, then the customer leaves.īased on a naïve analysis, the above description should ensure that the shop functions correctly, with the barber cutting the hair of anyone who arrives until there are no more customers, and then sleeping until the next customer arrives. If there is a free chair in the waiting room, the customer sits in it and waits his turn. ![]() If the barber is cutting hair, then the customer goes to the waiting room. If the barber is sleeping, then the customer wakes him up and sits in the chair. If there are no other customers waiting, he returns to his chair and sleeps in it.Įach customer, when he arrives, looks to see what the barber is doing. If there are, he brings one of them back to the chair and cuts his hair. When the barber finishes cutting a customer’s hair, he dismisses the customer and then goes to the waiting room to see if there are other customers waiting. The barber has one barber chair and a waiting room with a number of chairs in it. ![]() The Sleeping Barber Problem (attributed to Edsger Dijkstra (1965), one of the pioneers in computer science)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |