bjectives: To practice programming an application with multiple threads of execution and synchronizing their access to necessary shared objects.Description: In this programming assignment you will simulate the package shipping management system for an automated package shipping operation similar to the one depicted here:This example package shipping operation has five routing stations (S0 – S4), each of which has an input and output conveyor connecting to conveyor lines (C0 – C4) that go elsewhere in the system. Resources were limited when the system was built so each conveyor going to the rest of the facility must be shared between two routing stations. Since each routing station simultaneously needs an input and output connection to function, access to the shared conveyor lines must be strictly regulated. Flow direction in not important in our simulation.You have been hired to design a simulator for a new package management system being built with the same design, but possibly fewer/more stations. You are to implement this simulator in Java and have each routing station function in its own thread. A routing station moves packages from one of its connected conveyors to the other. A station’s workload is the number of times that a routing CNT 4714 –Project 2–Spring 2017conveyor4conveyor3conveyor 2conveyor1conveyor 0S0S1S4S3S2 Page 2station needs to have exclusive access to the input and output conveyors during the simulation. Once a routing station is granted access to both conveyors it calls its doWork()method during which it will flow packages down each of its connected conveyors (of course it must verify that it has access and isn’t in conflict with another routing station). After the packages-in and packages-out methods are run, the workload of the routing station is reduced by 1 and the routing station will release both of the conveyors and signal waiting routing stations that the conveyors are available. After executing a flow and releasing its conveyors, a routing station should sleep for some random period of time. A routing station’s thread stops running when its workload reaches 0. To prevent deadlock, ensure that each routing station acquires locks on the conveyors it needs in increasing numerical order.Restrictions: 1.Your source files should begin with comments containing the following information: /* Name:Course: CNT 4714 Spring 2017 Assignment title: Project 2 – Multi-threaded programming in Java Date: February 12, 2017 Class: */ 2.Do not use a monitor to control the synchronization in your program (i.e., do not use the Java synchronize statement).
-
Notifications
You must be signed in to change notification settings - Fork 1
kylegildea/Multithread-Java-Assignment
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published