Back to the 2022 paper

Module 3: Inter-process Communication

202214m

A bridge on a busy highway is damaged by a flood. One-way traffic is to be instituted on the bridge by permitting vehicles traveling in opposite directions to use the bridge alternately. The following rules are formulated for use of the bridge:
(a) At any time, the bridge is used by vehicle(s) traveling in one direction only.
(b) If vehicles are waiting to cross the bridge at both ends, only one vehicle from one end is allowed to cross the bridge before a vehicle from the other end starts crossing the bridge.
(c) If no vehicles are waiting at one end, then any numbers of vehicles from the other end are permitted to cross the bridge.
Develop a concurrent system to implement these rules.

Similar questions