# Question: Now consider a version of the bakery algorithm without the

Now consider a version of the bakery algorithm without the variable choosing. Then we have

1 int number[n];

2 while (true) {

3 number[i] = 1 + getmax(number[], n);

4 for (int j = 0; j < n; j++){

5 while ((number[j]! = 0) && (number[j],j) < (number[i],i)) { };

6 }

7 /* critical section */;

8 number [i] = 0;

9 /* remainder */;

10 }

Does this version violate mutual exclusion? Explain why or why not.

1 int number[n];

2 while (true) {

3 number[i] = 1 + getmax(number[], n);

4 for (int j = 0; j < n; j++){

5 while ((number[j]! = 0) && (number[j],j) < (number[i],i)) { };

6 }

7 /* critical section */;

8 number [i] = 0;

9 /* remainder */;

10 }

Does this version violate mutual exclusion? Explain why or why not.

**View Solution:**## Answer to relevant Questions

Consider the following program which provides a software approach to mutual exclusion: Integer array control [1: N]; integer k Where 1 ≤ k ≤ N, and each element of “control” is either 0, 1, Or 2. All elements of ...In the commentary on Figure 5.9 and Table 5.4, it was stated that “it would not do simply to move the conditional statement inside the critical section (controlled by s) of the consumer because this could lead to ...Consider a system consisting of four processes and a single resource. The current state of the claim and allocation matrices is: What is the minimum number of units of the resource needed to be available for this state to be ...Show how each of the techniques of prevention, avoidance, and detection can be applied to Figure. Consider a system with a total of 150 units of memory, allocated to three processes as shown: Apply the banker’s algorithm to determine whether it would be safe to grant each of the following requests. If yes, indicate a ...Post your question