Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Build a multithreading program. The goal here is to have all your threads finish and have no deadlocks while at the same time trying to
Build a multithreading program. The goal here is to have all your threads finish and have no deadlocks while at the same time trying to streamline the execution of your code. The assessment will have you build out a factory that builds out several products. You will be building the factory control mechanism that will manage the production of all products and ensure that at least a few of each product get produced in one day.
Your code should do the following
Instructions:
- Have a minimum of 4 classes of products: Cars, Duct Tape, Cameras, and Lava lamps.
- Have a construction method that will run a thread for a specific time. This time should be based on the complexity of the building of each product. For example, a car would take 8 seconds to build while duct tape would be 2 seconds.
- Have at least 4 threads that will simulate each production line. The issue with your factory is that only one thread can be running at a time. So, use your knowledge of threading to ensure that one thread does not dominate the 24 (second) production day.
- Your code should print out the total number of products produces for each product.
Show your code and execution (console) output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started