selection cannot be postponed indefinitely. A process cannot immediately re-enter the critical section if the other process has set its flag to say that it would like to enter its critical section. Bounded waiting Bounded waiting, or bounded bypass, means that the number of times a process is bypassed by another process after it has indicated its desire to enter the critical section is bounded by a function of the number of processes in the system. In Peterson's algorithm, a process will never wait longer than one turn for entrance to the critical section. Filter algorithm: Peterson's algorithm for more than two processes The filter algorithm generalizes Peterson's algorithm to processes. Instead of a boolean flag, it requires an integer variable per process, stored in a single-writer/multiple-reader (SWMR) atomic register, and additional variables in similar registers. The registers can be represented in pseudocode as arrays: level : array of N integers last_to_enter : array of N − 1 integers The variables take on values up to , each representing a distinct "waiting room" before the critical section. Processes advance from one room to the next, finishing in room , which is the critical section. Specifically, to acquire a lock, process executes i ← ProcessNo for ℓ from 0 to N − 2 exclusive level[i] ← ℓ last_to_enter[ℓ] ← i while last_to_enter[ℓ] = i and there exists k ≠ i, such that level[k] ≥ ℓ wait To release the lock upon exiting the critical section, process sets to −1. That this algorithm achieves mutual exclusion can be proven as follows. Process exits the inner loop when there is either no process with a higher level than , so the next waiting room is free; or, when , so another process joined its waiting room. At level zero, then, even if all processes were to enter waiting room zero at the same time, no more than will proceed to the next room, the final one finding itself the last to enter the room. Similarly, at the next level, will proceed, etc., until at the final level, only one process is allowed to leave the waiting room and enter the critical section, giving mutual exclusion. Unlike the two-process Peterson algorithm, the filter algorithm does not guarantee bounded waiting. Note When working at the hardware level, Peterson's algorithm is typically not needed to achieve atomic access. Some processors have special instructions, like test-and-set or