


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















bal = get_bal(acct); bal = bal – amt; bal = get_bal(acct); bal = bal – amt; put_bal(acct, bal); put_bal(acct, bal);
while (1) { acquire( lock ); critical section release( lock ); remainder section } We will look at several ways to implement this code
It’s process A’s turn It’s process B’s turn but process B doesn’t want to run
while (1) { choosing[i] = true; number[i] = max(number[0],…, number[n-1]) + 1; for (j=0; j<n; j++) { while (choosing[j]); while ((number[j]!=0) && ((number[j]<number[i])); } critical section number[i] = 0; remainder section } What’s wrong with this solution?