- Shared variables
- boolean flag[2];
- initially flag [0] = flag [1] = false.
- flag [i] = true Þ Pi ready to enter its critical section
- Process Pi
do {
flag[i] := true;
while (flag[j]) ; critical section
while (flag[j]) ; critical section
flag [i] = false;
remainder section
} while (1);
- Satisfies mutual exclusion, but not progress requirement.
No comments:
Post a Comment