Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment 3 Threads. Scientific Store A container contains 3 different objects: Laboratory: – Name of Head of Laboratory – Number of scientists in laboratory.

Similar presentations


Presentation on theme: "Assignment 3 Threads. Scientific Store A container contains 3 different objects: Laboratory: – Name of Head of Laboratory – Number of scientists in laboratory."— Presentation transcript:

1 Assignment 3 Threads

2 Scientific Store A container contains 3 different objects: Laboratory: – Name of Head of Laboratory – Number of scientists in laboratory Number of scientists = number of threads – Specialization – cost Equipment: – name – Items in package – cost Scientist: – name – Specialization – cost

3 Head Of Laboratory Includes everything that a laboratory includes – Number of scientists – Specialization Includes an executor with number of threads equal to number of scientists

4 Experiment Each experiment has specialization In order to run the experiment: – Make sure all pre-requirement experiments are already complete. – Find a laboratory with same specialization, if not found the buy a laboratory, and create a HeadOfLaboratory for it – Check if you have enough equipment in repository, if not buy equipment, and update the Repository Send experiment to the HeadOfLaboratory, for execution.

5 Execution of Experiment Each experiment has runtime value in hours. Daily cycle: runtime>=8 – Acquire equipment from Repository – Sleep 8 hours (this is our “work” day) – Release equipment to Repository. – Runtime = runtime – 8 If runtime>0, sleep 16 hours and repeat cycle. If 0<runtime<8: – Acquire equipment from Repository – Sleep runtime hours – Release equipment to Repository. – Runtime = 0. Execution is complete. Update state of experiment and notify ChiefScientist

6 ChiefScientist This object will act as our Observer, and will hold ChiefScientistAssistant Once an experiment is done, the ChiefScientist is notified of this, once notified the ChiefScientist will do the following: – Update all experiments that have the completed experiment as pre-requirement that is complete – Ask ChiefScientistAssistant to do another scan for experiments that are able to run.

7 ChiefScientistAssistant One of a kind! Will run as a thread when ChiefScientist asks him. Scans for experiments, and for each experiment: – Purchases equipment [if needed] – Purchases scientists [if needed] – Purchases laboratories [if needed] – Sends it to the correct HeadOfLaboratory Will shutdown everything once all experiments are complete.

8 Statistics Budget – how much money you have left after the whole process. MoneySpent – how much you spent. MoneyGained – how much money you gained. Scientists Purchased – scientists purchased, and their information Equipment Purchased – equipment purchased, and their information Laboratories Purchased – laboratories purchased and their information Completed Experiments – experiments complete, and their information

9 Input Files [PDF] Section 5

10 Questions?


Download ppt "Assignment 3 Threads. Scientific Store A container contains 3 different objects: Laboratory: – Name of Head of Laboratory – Number of scientists in laboratory."

Similar presentations


Ads by Google