logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

you are required to implement a Junction management system.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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.

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

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. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

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

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

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

. 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 Sea Ports. Here are the classes and their instance variables we wish to define:

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

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

816 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

568 Answers

Hire Me
expert
Husnain SaeedComputer science

509 Answers

Hire Me
expert
Atharva PatilComputer science

942 Answers

Hire Me

Get Free Quote!

317 Experts Online