subject

Objectives: 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: see image.
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 stations workload is the number of times that a routing station 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 isnt 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 stations 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:
Do not use a monitor to control the synchronization in your program (i. e., do not use the Java synchronize statement).
Input Specification:
Your program must initially read from a text file (config. txt) to gather configuration information for the simulator. The first line of the text file will be the number of routing stations to use during the simulation. Afterwards, there will be one line for each station. These lines will hold the amount of work each station needs to process (i. e, the number of times it needs to move packages down the conveyor system). Only use integers in your configuration file, decimals will not be needed. You can assume that the maximum number of stations will be 10.
Output Specification:
Your simulator must output the following text to let the user know what the simulator is doing in each of these situations:
1. An input conveyor is set:
Station X: In-Connection set to conveyor n
2. An output conveyor is set:
Station X: Out-Connection set to conveyor n
3. A stations workload is set:
Station X: Workload set. Station X has n package groups to move.
4. A station is granted access to a conveyor:
Station X: granted access to conveyor n
5. A station is releasing access to a conveyor:
Station X: released access to conveyor n
6. A station has completed its workload:
* * Station X: Workload successfully completed. * *
7. A station successfully flows packages down a conveyor:
Station X: successfully moves packages on conveyor n.
8. A station completes a flow:
Station X: has n package groups left to move.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, brainbean
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, Arealbot
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
image
Computers and Technology, 24.06.2019 15:30, S917564
The idea that, for each pair of devices v and w, there’s a strict dichotomy between being “in range” or “out of range” is a simplified abstraction. more accurately, there’s a power decay function f (·) that specifies, for a pair of devices at distance δ, the signal strength f(δ) that they’ll be able to achieve on their wireless connection. (we’ll assume that f (δ) decreases with increasing δ.) we might want to build this into our notion of back-up sets as follows: among the k devices in the back-up set of v, there should be at least one that can be reached with very high signal strength, at least one other that can be reached with moderately high signal strength, and so forth. more concretely, we have values p1 ≥ p2 ≥ . . ≥ pk, so that if the back-up set for v consists of devices at distances d1≤d2≤≤dk, thenweshouldhavef(dj)≥pj foreachj. give an algorithm that determines whether it is possible to choose a back-up set for each device subject to this more detailed condition, still requiring that no device should appear in the back-up set of more than b other devices. again, the algorithm should output the back-up sets themselves, provided they can be found.\
Answers: 2
You know the right answer?
Objectives: To practice programming an application with multiple threads of execution and synchroniz...

Questions in other subjects:

Konu
Physics, 06.01.2022 01:00
Konu
Computers and Technology, 06.01.2022 01:00
Konu
Mathematics, 06.01.2022 01:00