A match-and-set lock has a locked operating state and an unlocked
operating state controlled by the value C. The lock returns a value R=C,
to an inquiring user seeking access to the resource. A return value R=0
denotes that the resource is free, and a return value R.noteq.0 denotes
that the resource is locked by another user. The lock is responsive to a
command in the form (A, B) to B for C if A=C. Thus, the lock may be
locked by issuing the command (A, B) where A=C and B.noteq.0; and the
lock may be released by issuing the command (A, B) where A=C and B=0. A
deadlock condition may be avoided by setting the lock to the value
B=P+T*(N+1), where P<(N+1) and identifies the user issuing this
command (A, B), and T is the current global time stamp when the user
issues this command.