Junction Management System
In this assignment, you are required to implement a Junction management system. There are 4 lanes which intersect with each other. Trains can enter a lane from the directions as shown in the figure. North is top of the figure. Each lane can allow only one train to pass through it at a time. Each train is represented by an independent thread and it performs the following 3 functions, in order:
• Arrive Lane - arriveLane(): The front of the train arrives at the first intersection point in the lane.
• Cross Lane - crossLane(): The train crosses the lane.
• Exit Lane - exitLane(): The complete train exits the lane.
Figure 1: Junctions at the Subway
To prevent crashes and multiple trains entering a lane at the same time, the trains do the following:
• To arrive at a lane, a train blocks the first intersection on the lane in advance.
• To cross a lane it must block the next intersection on the lane.
• Since the size of train is large, it is safe to unblock the intersection points it has blocked earlier only after the train has exited the lane.
Note that following the above conditions can cause a deadlock. You are required to detect and resolve any deadlock. For this, a separate thread will be running, which periodically checks if there is a deadlock and signals one of the trains to go. You are free to use any synchronization primitives for implementing controllers, other critical sections/signalling in your code.
You submission will be judged on 3 properties:
• Safety: No crash can occur, and only one train can use a lane a time.
• Liveness: The system is not stuck forever.
• Starvation: No train should be starved from entering the lane.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of