Question: Do this task in c/c++ using monitors operating system.This is the complete question Task 1 Consider a situation having three Coffee loving persons as threads

Do this task in c/c++ using monitors operating system.This is the completeDo this task in c/c++ using monitors operating system.This is the complete question

Task 1 Consider a situation having three Coffee loving persons as threads and one agent thread. Each person is required to drink coffee but to do that, the person thread needs three ingredients: coffee, water, and milk. Each thread has infinite supply of one specific element, e.g. the first one has infinite supply of coffee, the second one has infinite supply of water and the last one has infinite supply of milk. Similarly, the agent has infinite supply of all ingredients and it chooses two out of three ingredients at random repeatedly. Afterwards, agent puts selected ingredients on table and the person having deficient ingredients can take the two ingredients and make coffee to drink. For example, if agent selects water and milk randomly then the only thread who can drink is person thread 1. The agent then puts out another two of the three ingredients, and the cycle repeats. Above mentioned behavior is required to be simulated using monitors only. Also use meaningful variable and functions names

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 Databases Questions!