INITIALIZATION:
typedef char boolean; ... shared boolean flags[n - 1]; ... flags[i ] = FREE; ... flags[j ] = FREE; ...ENTRY PROTOCOL (for Process i ):
/* wait while the other process is in its CS */ while (flags[j ] == BUSY) { } --> /* claim the resource */ flags[i ] = BUSY;EXIT PROTOCOL (for Process i ):
/* release the resource */ flags[i ] = FREE;ANALYSIS: Suppose Process i is interrupted at precisely the point marked by the arrow in the exit protocol. At this point the process believes it has the right to proceed, but it has not yet set its flag. If Process j executes its entry protocol before Process i resumes, it will enter its CS. When Process i resumes, it will enter as well. The mutual exclusion requirement is violated.