Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

1)For the bakery algorithm in Section 2.2.2, the value of number[i] is notbounded.

1)For the bakery algorithm in Section 2.2.2, the value of number[i] is notbounded.(a) Explain how

the value of number[i] grows without bound.

(b) One suggestion for bounding the value of number[i] is to replace the

statement

number[i] = max(number) + 1;

with the statement

// numThreads is # of threads in the program

number[i] = (max(number) + 1) % numThreads;

Is this suggestion correct? Explain.

2)Suppose that we switch the order of the first two statements in Peterson’s
algorithm:
boolean intendToEnter0 = false, intendToEnter1 = false;
int turn; // no initial value for turn is needed.
T0 T1
while (true) { while (true) {
turn = 1; (1) turn = 0; (1)
intendToEnter0 = true; (2) intendToEnter1 = true; (2)
while (intendToEnter1 && (3) while (intendToEnter0 && (3)
turn == 1) {;} turn == 0) {;}
critical section (4) critical section (4)
intendToEnter0 = false; (5) intendToEnter1 = false; (5)
noncritical section (6) noncritical section (6)
} }
Does the modified solution guarantee mutual exclusion? Explain. If
yes, does the modified solution guarantee progress and bounded
waiting? Explain.

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"