Question
SUBJECT : OPERATING SYSTEMS - I need solution for all the 3 Questions below. SLEEPING BARBER PROBLEM In computer science, the sleeping barber problem is
SUBJECT : OPERATING SYSTEMS - I need solution for all the 3 Questions below.
SLEEPING BARBER PROBLEM
In computer science, the sleeping barber problem is a classic inter-process that can be found in the operating systems. The problem is analogous to that of keeping a barber working when there are customers, resting when there are none, and doing so in an orderly manner. This case is instructive because the problems encountered when attempting to provide tailored access to barbershop resources are like those encountered in a real operating system. The analogy is based upon a hypothetical barber shop with one barber. The barber has one barber chair and a waiting room with three of chairs in it. When the barber finishes cutting a customer's hair, he dismisses the customer (after getting the payment at the cash register) and go back to the waiting room to see if there are other customers waiting. If there are customers, he brings one of customer back to the chair and cut his hair. If there are no other customers waiting, barber returns to sleep at the Backoffice. He will wake up when the newly arrived customer rings the bell (the call form the arrived customer). The barber spends 15 minutes to get ready and then barber will go to waiting room to pick up customer and then go to the Chair, with the customer. At the chair barber will be serving to the customer (basically cutting the hair based on customer needs /desire). When the job done, barber will bring the customer to the cash register. It takes 15 minutes to process the payment. At the cash register barber will collect the payment from the customer and then will let customer exit. Then barber will go back to the waiting room. If there are no other customers waiting, barber returns to sleep at the Backoffice. The barber must divide his time among cutting hair, accepting payment, and sleeping while waiting for a customer. When a customer arrives to the shop, he enters the waiting room where there are only three chairs for the customers to sit and wait. If there is a free chair in the waiting room, the customer sits in it and waits for his turn. If there is no free chair, the customer leaves/exit. If there are no more customer before the newly arrived customer, and customer will sit and then ring the bell to call the barber. If the barber not shows up then customer will exit. If there is not seating space in the waiting room then customer will exit. If there is seating space in the waiting room, then customer will have seat and wait. If there are no more customer before the customer, and then customer rings the bell and If barber not showed up then exit. When the barber comes, then go to the chair with him. Customer stays at chair till the barber does his job (cut the hair). Then go to the cash register and pay the money and Exit. BABER SHOP SERVICE DURATIONS Buzzcut 60 minutes Regular Haircut 90 minutes Hot Towel Shave 120 minutes Haircut and Beardtrim 150 minutes ON THE DAY OF THE SERVICE Regular business hours 8:00 5:00PM ( no lunch break) Customer A who wants Regular Haircut arrives at 8:30AM and must exit at 11:00AM Customer B who wants Haircut and Beardtrim arrived at 10:00AM and must exit at 2:00PM Customer C who wants Buzzcut arrived at 10:30AM and must exit at 3:00PM Customer D who wants Hot Towel Shave arrived at 3:45PM and must exit at when store closed at 5:00PM. Customer E who wants Haircut and Beardtrim arrived at 10:15AM and must exit at 12:30PM QUESTION 1: Develop two State Transition diagrams . One for the customer and one for the Barber QUESTION 2: Develop the Execution Profile table of all customers based on the given parameters. Your table should have, the Process (the customer), Arrival time, total execution time for each process and deadline for the process to be completed. QUESTION 3: Develop the schedule diagram for First-Come-First-Served (FCFS) Provide report on the customers about the process they received. Which one had his hair done? And which one not?
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