GATE Question Bank » CSE » OPERATING SYSTEMS
A) Release all resources before requesting a new resource
B) Number the resources uniquely and never request a lower numbered resource than the last one requested.
C) Never request a resource after releasing any resource
D) Request and all required resources be allocated before execution
Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below. repeat flag [i] = true; turn = j; while ( P ) do no-op; Enter critical section, perform actions, then exit critical section flag [ i ] = false; Perform other non-critical section actions. until false; For the program to guarantee mutual exclusion, the predicate P in the while loop should be ?