Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sleeping Barber Problem. Fill out the 7 tables on the right after each semaphore and then answer the questions as the bottom. AZWRS BR CR
Sleeping Barber Problem. Fill out the 7 tables on the right after each semaphore and then answer the questions as the bottom. AZWRS BR CR AZWRS Queue BR Queue CR Queue NFWRS Barber 1 Barber 2 Customer1 Customer 2 Customer 3 ICustomer 4 semwait(A2WRS) sem Wait(A2WRS) sem Wait(CR) if(NFWRS>0) NFWRS -= 1; semSignal(CR) sem Wait(AZWRS) semwait(A2WRS) semSignal(AZWRS) if(NFWRS>0) NFWRS -= 1; sem Signal(CR) sem Signal(A2WRS) if(NFWRS>) NFWRS -= 1; semSignal(AZWRS) NFWRStal semSignal(BR) 16 semSignal(A2WRS) 17 semwait(AZWRS) if(NFWRS>) NEWRS -= 1; semSignal(CR) 20 semSignal( A2WRS) 21 semWait(CR) 22 semWait(A2WRS) 23 NFWRS+=1 24 semSignal (BR) 25 semSignal(AZWRS) 261 27 semwait(BR) sem Wait(BR) 1. How many people/processes were involved with the barbershop? 2. How many people were completely done getting a haircut at the end of the code stepthrough? 3. How many people were still waiting to get their hair cut? 4. How many people walked out? (Why?) Sleeping Barber Problem. Fill out the 7 tables on the right after each semaphore and then answer the questions as the bottom. AZWRS BR CR AZWRS Queue BR Queue CR Queue NFWRS Barber 1 Barber 2 Customer1 Customer 2 Customer 3 ICustomer 4 semwait(A2WRS) sem Wait(A2WRS) sem Wait(CR) if(NFWRS>0) NFWRS -= 1; semSignal(CR) sem Wait(AZWRS) semwait(A2WRS) semSignal(AZWRS) if(NFWRS>0) NFWRS -= 1; sem Signal(CR) sem Signal(A2WRS) if(NFWRS>) NFWRS -= 1; semSignal(AZWRS) NFWRStal semSignal(BR) 16 semSignal(A2WRS) 17 semwait(AZWRS) if(NFWRS>) NEWRS -= 1; semSignal(CR) 20 semSignal( A2WRS) 21 semWait(CR) 22 semWait(A2WRS) 23 NFWRS+=1 24 semSignal (BR) 25 semSignal(AZWRS) 261 27 semwait(BR) sem Wait(BR) 1. How many people/processes were involved with the barbershop? 2. How many people were completely done getting a haircut at the end of the code stepthrough? 3. How many people were still waiting to get their hair cut? 4. How many people walked out? (Why?)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started