Two processes are trying to enter their critical sections, executing the same program:

while true do begin
  // Noncritical section.
  L: if not(id=0) then goto L;
  id := i; 
  pause(delay);
  if not(id=i) then goto L;
  // Inside critical section.
  id := 0; 
end

The constant i identifies the process (i.e., has the value 1 or 2), and id is a global variable, with value 0 initially. The statement pause(delay) delays the execution for delay time units. It is assumed that the assignment id := i; takes at most t time units.

Tasks: