Skip to content

The advanced sleeping barber problem with the description (in Chinese) below.

License

Notifications You must be signed in to change notification settings

Ma-Weijian/Advanced-Sleeping-Barber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Advanced-Sleeping-Barber

The advanced sleeping barber problem with the description (in Chinese) below.

一家理发店里有3位理发师,3把理发椅。三个理发师中,两个理发师只会为男士理发,另外一个理发师可以为女士烫发或为男士理发(女顾客优先,当没有女顾客时才为男士理发)。店内有6把供等候理发的顾客坐的椅子。如果没有顾客,则理发师在理发椅上睡觉。当一个男顾客到来时,他会优先叫醒只会理发的理发师,除非两位只会理发的理发师发师已经为人服务;女顾客来时,只会找烫发的理发师(如果当前烫发的理发师空闲,则直接为其进行烫发服务;如果当前有男顾客,则为该男顾客理发完后会为女顾客进行烫发服务;若当前为女顾客则等待)。如果三个理发师正在为三个顾客理发时又有顾客来到,并且如果有空椅子可坐,他们就坐下来等待。如果没有空椅子,且没有椅子可坐等待的人数不超过座椅1倍时(即最多会有12个人在等,3个人在理发),他会随机选择等待或离开,但当无位等待人数超过座椅数时,他就一定选择离开。设计同步机制使理发师能正常工作,顾客能得到正常的服务。(设计时可假定:烫发时间更长,为理发时长的6倍;男顾客数量是女顾客数量的4倍)

Requirements: A Linux distribution with gcc and GNU make.

Compile: Type make in your working directory

About

The advanced sleeping barber problem with the description (in Chinese) below.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published