Question

i need the code in C please ,,,, POSIX Synchronization In the Sleeping-Barber problem, a barbershop...

i need the code in C please ,,,,


POSIX Synchronization


In the Sleeping-Barber problem, a barbershop consists of a waiting room with n chairs and one barber chair. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and the barber is asleep, the customer wakes up the barber. If the barber is busy but chairs are available, then the customer sits in FCFS free chairs. If all chairs are occupied, then the customer is blocked. Using POSIX semaphores, write a program to synchronize the operations of the barber and the customers. Your program should display all barbershop operations. Note: waiting room size n should be initialized by user on the command line.


0 0
Add a comment Improve this question Transcribed image text
Answer #1

hWaitin COL Mute uedot Mutal exctuion Shacted dacs Int customen oid bestbenC) Signal cmutex) wait (nutex)ehe nacu) and Vest iae need tuei ntl aues speciied Cutome wait (Chaiyy)halオ etje

Add a comment
Know the answer?
Add Answer to:
i need the code in C please ,,,, POSIX Synchronization In the Sleeping-Barber problem, a barbershop...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++. This program should not be terminated or crashed (terminate abnormally) while processing invalid data...

    In C++. This program should not be terminated or crashed (terminate abnormally) while processing invalid data types. It should continue to prompt the user to input the correct data type. A barbershop consists of a waiting room with n chairs and a barber room with one barber chair. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the...

  • C PROGRAM: In this assignment, you will use the concept of POSIX threads, semaphores and mutex...

    C PROGRAM: In this assignment, you will use the concept of POSIX threads, semaphores and mutex locks. Consider a very small bank: XYZ. This bank has only one cashier (aka bank teller or customer representative) and a small waiting room for any incoming customers while the cashier is busy with other customer. There is a sofa which can only hold 5 people at maximum. The cashier can only serve one customer at any time. When the cashier is serving one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT