Question: (8) The Bakers Problem. Consider a system with three baker processes and one chef process. Each baker continuously kneads the dough and then bakes bread.

 (8) The Bakers Problem. Consider a system with three baker processes

(8) The Bakers Problem. Consider a system with three baker processes and one chef process. Each baker continuously kneads the dough and then bakes bread. But to knead and bake bread, the baker needs three ingredients: flour, eggs, and yeast. One of the baker processes has flour, another has eggs, and the third has yeast. The chef has an infinite supply of all three ingredients. The chef places two of the ingredients on the table. The baker who has the remaining ingredient then kneads and bakes his bread signaling the chef on completion. The chef then puts out another two of the three ingredients, and the cycle repeats. Write the pseudocode to simulate this system using semaphores. You should write two processes: the chef process and a baker processes. (Note: the three bakers can be represented by a single process with a parameter value to indicate which ingredient the baker holds, e.g., baker(i) where i can be flour, eggs, or yeast.) The shared data structures are semaphore ingredientI0. .2] //initially 0 semaphore chef //initially 1 (8) The Bakers Problem. Consider a system with three baker processes and one chef process. Each baker continuously kneads the dough and then bakes bread. But to knead and bake bread, the baker needs three ingredients: flour, eggs, and yeast. One of the baker processes has flour, another has eggs, and the third has yeast. The chef has an infinite supply of all three ingredients. The chef places two of the ingredients on the table. The baker who has the remaining ingredient then kneads and bakes his bread signaling the chef on completion. The chef then puts out another two of the three ingredients, and the cycle repeats. Write the pseudocode to simulate this system using semaphores. You should write two processes: the chef process and a baker processes. (Note: the three bakers can be represented by a single process with a parameter value to indicate which ingredient the baker holds, e.g., baker(i) where i can be flour, eggs, or yeast.) The shared data structures are semaphore ingredientI0. .2] //initially 0 semaphore chef //initially 1

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!