Question: Operating System dining savages problem with monitor implementation: The problem of the dining savages (an allusion to the classic dining philosophers) is based on the
Operating System dining savages problem with monitor implementation:
The problem of the dining savages (an allusion to the classic dining philosophers) is based on the arguably tasteless analogy of a number of members of a primitive culture, hereinafter called the "savages", sharing a meal from a single pot. The primary abstractions are the savages themselves, a cook, and the pot. The pot contains a certain number of servings of savage sustenance (the nature of which will be left to your imagination). Each of the savages can freely remove a serving from the pot so long as the pot is not empty. So before taking a serving, a savage must check to make sure the pot is not empty. In the case in which the pot is empty, the savage must wake up the cook to refill the pot, after which the feast continue. The savages, then, can eat only when the pot is not empty, and the cook can fill the pot only when the pot is empty.
Question:
The savage waits if there is EmptyPot, the cook waits for NotEmpty.
a. Can we, instead of two condition variables, use only one? (lets say: potStatus). Discuss.
b. Is the assumption: If we have only one condition variable PotStatus, savage and cook cannot block at the same time on the condition variable correct?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
