摘要 |
A method for efficiently acquiring and releasing a shared locking mechanism in a multiprocessor environment comprises updating variables associated with the locking mechanism and variables associated with processors seeking to acquire the lock. If the lock is currently occupied, a processor waits in accordance with information initialized in a spin variable associated with the processor. Upon releasing the lock, a relinquishing processor determines whether there are other processors waiting to acquire the lock. If other processors are waiting to acquire the lock, the relinquishing processor alters a successor variable associated with the waiting processor in the waiting processor's local shared memory so that the lock mechanism can be passed on and a first-in and first-out behavior of a waiting queue can be maintained.
|