项目作者: skirupa

项目描述 :
Hilzer's barber shop synchronization problem solved using semaphore and threading concepts in C programming language.
高级语言: C
项目地址: git://github.com/skirupa/Hilzer-s-barber-shop-synchronization-problem.git


Hilzer-s-barber-shop-synchronization-problem

This is a problem from “The Little Book Of Semaphores”.
PROBLEM :
Our barbershop has three chairs, three barbers, and a waiting area that can accommodate four customers on a sofa and that has standing room for additional customers.
Fire codes limit the total number of customers in the shop to 20.
A customer will not enter the shop if it is filled to capacity with other customers.
Once inside, the customer takes a seat on the sofa or stands if the sofa is filled.
When a barber is free, the customer that has been on the sofa the longest is served and, if there are any standing customers,
the one that has been in the shop the longest takes a seat on the sofa.
When a customer’s haircut is finished, any barber can accept payment, but because there is only one cash register,
payment is accepted for one customer at a time. The bar- bers divide their time among cutting hair, accepting payment, and sleeping in their chair waiting for a customer.

Installation

  1. git clone https://github.com/skirupa/Hilzer-s-barber-shop-synchronization-problem

Usage

  1. Run with a C compiler.