var enter1, enter2 = false : boolean ;
Process P1
loop
{entry protocol}
enter1 := true ; {announce intent to enter}
while enter2
do null end;
{wait if other process is in CS}
{critical section}
enter1 := false {exit protocol}
end
end ;
Process P2
loop
{entry protocol}
enter2 := true {announce intent to enter}
while enter1
do null end ;
{wait if other process is in CS}
{critical section}
enter2 := false {exit protocol}
end
end ;