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

1 Expert Approved Answer
Step: 1 Unlock

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... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

6363b28c0a329_237333.pdf

180 KBs PDF File

Word file Icon

6363b28c0a329_237333.docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!