Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Imagine a very long bridge across the Mississippi River. A car will take upwards of 15 minutes to cross this bridge. Due to construction,

image

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, the west-east and the east-west direction. 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 (otherwise there would be little bridge utilization and arriving cars would have to wait a long time). 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 to allow traffic 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 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(), to be executed when a car enters and exits the bridge. Your solution must show all the 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 any direction. Develop a pseudocode monitor solution; You do not have to implement the solution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Engineering Economy

Authors: William G. Sullivan, Elin M. Wicks, C. Patrick Koelling

15th edition

132554909, 978-0132554909

More Books

Students also viewed these Programming questions