Welcome![Sign In][Sign Up]
Location:
Downloads SourceCode OS program
Title: barber Download
 Description: Using semaphore to solve barbers problem,there’s one barber,infinite customer,and a few waiting position,the number of waiting position is depend on the user. 3 semaphores are involved in the program: m_h,barbers,customers.Barbers is for the hair cutting process,customers Is for each customer’s arriving process,m_h is for a waiting position counter.There’re 2 more handles:threada,threadb as thread handle. Whenever a customer arrives,program prints: No.xxx customer is coming.If there exists any empty waiting position,the customer turn into a waiting situation,if not,program prints: No room for No.xxx customer,it s leaving.When the barber finishes a haircut,the barber thread prints: Done!Barber has cut a customer.....,meanwhile,the customer thread also prints: No.xxx customer has finished and leaving. With a While(1){} structure,the barber thread would never stop .The customer thread has no While() structure but the main function will continually and ramdomly create a customer
 Downloaders recently: [More information of uploader destiny1891]
 To Search: barber problem
File list (Check if you may need any files):
barber.cpp
    

CodeBus www.codebus.net