Homework 03 Solution

$29.99 $18.99

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…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product
  1. 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.

  1. Develop a solution for the Dining Philosopher’s problem using AND-Synchronization (i.e., Parallel Semaphores SP and SV).

Note: For the two problems listed in this homework, you must develop a solution and submit it. However, you do not have to actually implement these solutions.