If two processes attempt to enter a critical section at the same time, the algorithm will allow only one process in, based on whose turn it is. If one process is already in the critical section, the other process will busy wait for the first process to exit. This is done by the use of two flags, and , which indicate an intention to enter the critical section on the part of processes 0 and 1, respectively, and a variable that indicates who has priority between the two processes.