In python In a hotel, there are a number of guests and cleaning staff. There is a conference room where guests can enter to have a party.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question

In python

In a hotel, there are a number of guests and cleaning staff. There is a conference room where guests can enter to have a party.

Rules of using the room

  1. The guests and cleaning staff will be processes in your assignment.
  2. If someone from the cleaning staff is in the room cleaning, no guest can enter the room. Only one person from the cleaning staff can be in the room at a time. If guests are in the room, the cleaning staff will wait until the room is empty before entering.
  3. If the room is empty or other guests are in the room, guests can enter the room. You can have multiple guests in the room at the same time.
  4. The first guest to enter the empty room, will turn on the lights.
  5. The last guest to leave the room, will turn of the lights. (This is not the first guest in most cases)
  6. Guests can enter and leave the room at anytime as long as the room is empty or contains other guests. It is not uncommon for guests to enter the room, leave and then enter the room again while the party is happening.
  7. Assign each cleaner and guest an unique number/ID.
  8. Use constants CLEANING_STAFF and HOTEL_GUESTS to know how many processes to create.
  9. Remember, multiple guests must be able to be in the room at the same time.
  10. Run your program for 1 minute. While your program is running, keep track of the number of times the room of cleaned and the number of parties held. A party starts with the lighting being turned on and ends when the lights are turned off.
  11. Make sure your assignment matches the format/text of the sample output below.
  12. You are not allowed to use lists or queues to control access to the room. The solution requires 2 locks.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole