Question: Note: All Solution are to be written by C language 1. Write a pthreads solution to the following problem. A barber has one barber chair

Note: All Solution are to be written by C language

Note: All Solution are to be written by C language 1. Write

1. Write a pthreads solution to the following problem. A barber has one barber chair and a waiting room with a number of chairs in it. When the barber finishes cutting a customer's hair, she dismisses the customer and then goes to the waiting room to see if there are other customers waiting. If there are, she brings one of them back to the chair and cuts his hair. If there are no other customers waiting, she returns to her chair and sleeps in it. Each customer, when he arrives, looks to see what the barber is doing. If the barber is sleeping, then the customer wakes her up and sits in the chair. If the barber is cutting hair, then the customer goes to the waiting room. If there is a free chair in the waiting room, the customer sits in it and waits his turn. If there is no free chair, then the customer leaves

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!