Software Solutions:
Algorithm 3
ä Initialization:
flag[0]:=flag[1]:=false
turn:= 0 or 1
ä Willingness to enter
CS specified by
flag[i]:=true
ä If both processes
attempt to enter their
CS simultaneously,
only one turn value
will last
ä Exit section: specifies
that Pi is unwilling to
enter CS
ä This algorithm is also
known as “Peterson’s
Algorithm”