Question: Write synchronization code to simulate each of the following scenarios: a. (4 points) At a jungle bridge, there is a weight limit for the number


Write synchronization code to simulate each of the following scenarios: a. (4 points) At a jungle bridge, there is a weight limit for the number of people crossing the bridge. Adults weigh twice as much as kids. Write code to simulate adults and kids crossing such that the total weight on the bridge never exceeds the equivalent of 4 kids. b. A barrier (4 points): a group of us go to a restaurant; we wait until the last person arrives before we go in. c. (4 points) A bakery where threads of three types representing three ingredients cake mix, filling and icing arrive. Whenever we have one of each, we make a cake. d. (3 points bonus) The recipe in part b has changed - now we need two portions of cake mix to arrive (in addition to filling and icing) before we can make cake. Update your implementation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
