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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
You know the right answer?
Objectives: To practice programming an application with multiple threads of execution and synchroniz...
Questions
question
Physics, 26.05.2020 12:57
question
Mathematics, 26.05.2020 12:57
question
Mathematics, 26.05.2020 12:57
question
Biology, 26.05.2020 12:57
question
Mathematics, 26.05.2020 12:57
question
Mathematics, 26.05.2020 12:57
question
Physics, 26.05.2020 12:57
Questions on the website: 13722367