Question: A. Describe a story with concurrent threads that are synchronized by signal and continue monitors. Describe the situation (by giving the execution sequence) that will

A. Describe a story with concurrent threads that are synchronized by signal and continue monitors.
Describe the situation (by giving the execution sequence) that will show the need for rechecking the condition variable using a while loop. Briefly explain.
B. Consider the following savage-cook monitor version.
1. Consider the first version of the implementation in which we had only one signal in each method.
Given service methods: getServing(), putServings(), with local variables size = M and #servings = 0, and queues NotEmpty and Empty.
getServing(){
while (#servings == 0){
signal(NoFood);
wait(Food); }
#Servings--; }
putServings(){
If(#servings !=0) wait(NoFood); #servings = M;
signal(Food);
}
Give the execution sequence that shows deadlock or delay (depending on the fact that savage execution code is or is not a while(true) loop).
2. Do we need to have if (#servings !=0) wait(NoFood) in the Cook pseudo- code ? Or, since if a savage finds the pot empty it will signal the Cook
anyway, wait(NoFood) only is enough.
What will be the outcome of the above change? (what condition of Critical Section Problem might be violated?) Give the execution sequence that will show it.
3. The savage waits if there is no food, the cook waits if there is food.
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?
C. Review the 3 implementations of the reader-writer problem:
Signal and Exit Monitor: rwse.java rwdr.java Signal and Continue Monitor: rwmo.java rwdr.java Signal and Continue with Notification Objects: rwcv.java rwdr.java
For each implementation explain how the reader-writer policy is enforced and how the No Starvation condition (for readers and for writers) is satisfied. Emphasize on what is characteristic to each of the three implementations.
.

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!