Imagine a very long bridge across the Mississippi River. A car will take upwards of 15 minutes to cross this bridge. Due to construction, the bridge has been reduced to a single lane that has to be shared by traffic in both directions. It is obviously not possible to allow traffic in both directions simultaneously, and so a special traffic control mechanism is installed with the following rules: An arriving car will have to wait if the bridge is currently occupied by one or more cars moving in the opposite direction. • Multiple cars are allowed to cross the bridge in the same direction at the same time (one after another) In order to avoid starvation, the entry of cars onto the bridge in one direction must be stopped after a batch of K cars has entered the bridge from one direction, to allow traffic moving in the opposite direction (if there are any cars waiting) • If there are no cars, the bridge is open in both directions, and the first arriving car will determine the direction of traffic. Viewing each car as a process that is traveling in either the West-East (WE) or East-West (EW) direction, develop a MONITOR that implements the rules listed above. Your MONITOR must use the monitor procedures Enter_WE(), Enter_EW(), Exit_WE(), Exit_EW() when a car enters and exits the bridge. Must show all necessary MONITOR variables and condition variables. It must not unnecessarily restrict vehicles attempting to cross the bridge, must be deadlock free, and must not starve traffic in either direction. Note: You don't actually have to implement these solutions. This should be done in pseudo-code. Note: make sure to • Provide the Enter_WE, Enter_EW, Exit_WE, Exit_EW procedures or equivalents. • Define any variables or condition variables needed for traffic control Implement the rule that cars must wait if the bridge is currently occupied by cars moving in the opposite direction Implement the rule that multiple cars are allowed to cross in the same direction Implement the rule of stopping the entry of cars after K cars have entered the bridge to avoid starvation. Efficiently utilize the bridge by allowing traffic in the opposite direction when possible
Imagine a very long bridge across the Mississippi River. A car will take upwards of 15 minutes to cross this bridge. Due to construction, the bridge has been reduced to a single lane that has to be shared by traffic in both directions. It is obviously not possible to allow traffic in both directions simultaneously, and so a special traffic control mechanism is installed with the following rules: An arriving car will have to wait if the bridge is currently occupied by one or more cars moving in the opposite direction. • Multiple cars are allowed to cross the bridge in the same direction at the same time (one after another) In order to avoid starvation, the entry of cars onto the bridge in one direction must be stopped after a batch of K cars has entered the bridge from one direction, to allow traffic moving in the opposite direction (if there are any cars waiting) • If there are no cars, the bridge is open in both directions, and the first arriving car will determine the direction of traffic. Viewing each car as a process that is traveling in either the West-East (WE) or East-West (EW) direction, develop a MONITOR that implements the rules listed above. Your MONITOR must use the monitor procedures Enter_WE(), Enter_EW(), Exit_WE(), Exit_EW() when a car enters and exits the bridge. Must show all necessary MONITOR variables and condition variables. It must not unnecessarily restrict vehicles attempting to cross the bridge, must be deadlock free, and must not starve traffic in either direction. Note: You don't actually have to implement these solutions. This should be done in pseudo-code. Note: make sure to • Provide the Enter_WE, Enter_EW, Exit_WE, Exit_EW procedures or equivalents. • Define any variables or condition variables needed for traffic control Implement the rule that cars must wait if the bridge is currently occupied by cars moving in the opposite direction Implement the rule that multiple cars are allowed to cross in the same direction Implement the rule of stopping the entry of cars after K cars have entered the bridge to avoid starvation. Efficiently utilize the bridge by allowing traffic in the opposite direction when possible
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
Please help with this question!! Please provide explanations as well!
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
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