Computer systems have resources that are often shared by plural processes
(or threads). It is often desirable to limit access to these shared
resources to one process at a time. Historically locks were used in
conjunction with conditional tests to provide exclusive access to a
region of code or data. Instead, a global variable contains a pointer to
either a protected resource, or an exchange instruction. A process
exchanges its' local variable with the global variable and jumps to the
location in the exchanged local variable. If the global variable had the
pointer to the shared resource before the exchange, then the jump enters
the protected region. If not, the jump returns to exchange variables
again. As soon as the pointer to the protected resource is returned to
the global variable, a next exchange and jump will access the shared
resource.