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.
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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
- The guests and cleaning staff will be processes in your assignment.
- 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.
- 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.
- The first guest to enter the empty room, will turn on the lights.
- The last guest to leave the room, will turn of the lights. (This is not the first guest in most cases)
- 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.
- Assign each cleaner and guest an unique number/ID.
- Use constants CLEANING_STAFF and HOTEL_GUESTS to know how many processes to create.
- Remember, multiple guests must be able to be in the room at the same time.
- 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.
- Make sure your assignment matches the format/text of the sample output below.
- You are not allowed to use lists or queues to control access to the room. The solution requires 2 locks.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education