Question
A factory makes glass bottles. A customer can place an order for either 10 transparent or 10 painted bottles. There are glass blowers,
A factory makes glass bottles.
A customer can place an order for either 10 transparent or 10 painted bottles.
There are glass blowers, painters and packers in the factory.
As long as an order is not placed, no glass is blown.
As long as a bottle is not blown, no bottle is painted.
If the order is for transparent bottles, the painter does not work, and the bottles are passed to the packer.
If the order is for painted bottles, the painter paints them and passes them on to the packer.
The packer does not work as long as he does not receive bottles. The packer places 10 bottles in a crate, after which he tells the customer that the order is ready.
The customer must not try to pick the order before it is ready.
A new customer must not place order before the previous one picks his order.
Insert necessary synchronization and mutual exclusion with semaphores in the given code. Do not forget to initialize them. You may use if-else structures. If you use them, place opening and closing brackets for them correctly.
Step by Step Solution
3.49 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
A factory makes glass bottles u A customer can place an order for either 10 transparent or 10 painted bottles u There are glass blowers painters and p...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
Document Format ( 2 attachments)
6363b28c0a329_237333.pdf
180 KBs PDF File
6363b28c0a329_237333.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started