INITIALIZATION:
typedef char boolean; ... shared boolean flags[n -1]; ... flags[i ] = FREE; ... flags[j ] = FREE; ...ENTRY PROTOCOL (for Process i ):
/* claim the resource */ flags[i ] = BUSY; --> /* wait if the other process is using the resource */ while (flags[j ] == BUSY) { flags[i ] = FREE; delay a while ; flags[i ] = BUSY; }EXIT PROTOCOL (for Process i ):
/* release the resource */ flags[i ] = FREE;ANALYSIS: This is the most promising solution, but alas, we still have a problem with bounded waiting . Suppose Process j continually reenters its entry protocol after leaving its exit protocol, while Process i is waiting. It is possible That Process j will repeatedly reach the while test when Process i has temporarily cleared its flag. We cannot place a bound on how many times this could happen.