Question: There is a plate on the table. The maximum amount of apples that could be on the plate is 5. Parents (father and mother) only

There is a plate on the table. The maximum amount of apples that could be on the plate is 5. Parents (father and mother) only put apples on the plate, and one parent can only put one apple at a time. Meanwhile, children (more than one) only take apples from the plate, and one child can only take one apple at a time. At any time, only one person can put or take one apple onto or from the plate. Parents cannot put apple onto the plate if there are 5 apples there. Children cannot take apple from the plate if there is no apple there. Design your solution using Semaphore to enforce Mutual Exclusion for parents and children.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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

Students Have Also Explored These Related General Management Questions!