ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > zstu-(2021-2022)-1 > online discussion >
online discussion-1 Version 0
👤 Author: by writer 2021-10-20 03:22:17
The Customers and Barbers Problem (real case in a barbershop near a University).
A barbershop consists of n waiting chairs and has a chief barber B0(expensive cost) and two ordinary barbers(B1,B2). The customers are classified into three classes. Class A only asks chief barber's service, Class B only asks ordinary barber's service , Class C asks barber' service no matter the barber is chief or not. When a customer enters the barbershop, if all waiting chairs are occupied, the customer leaves the shop , otherwise the customer sits in one free chair at the end of queue. When any barber is free, he calls a customer in the queue who matches him in the way "first come first serve" and serve this customer. If there are more than one barber who are free, the way which barber calls customer first is according to the order(B0,B1,B2). If a barber is free and there are no customers who match him , he takes a rest. If waiting customers see their matched barbers are taking a rest, they arouse the barbers' attention. Write a program to coordinate the barbers and customers.

Please login to reply. Login

Reversion History

Loading...
No reversions found.