See live article
that allows two processes to share a single-use resource without conflict, using only shared memory for communication.
A Simpler Solution: Peterson's Algorithm
This article is from
. All text is available under the terms of the
GNU Free Documentation License