Patent ID: 8468169

Claim:
A method of providing locks in a computer comprised of a processor chip comprising a plurality of cores, wherein the chip further comprises a hardware lock, the method comprising: maintaining a data structure comprising software locks stored in memory, the data structure corresponding to a processor chip comprising a plurality of cores, wherein the chip includes a register comprising a hardware lock; attempting to lock the hardware lock by any given one of the plurality of cores whenever the given core is to lock any given one of the software locks, wherein attempting to lock the hardware lock is performed by at least a locking instruction native to the chip; when the attempt to lock the hardware lock by the given core is successful, testing whether the given software lock is locked, and: when the given software lock is not locked, locking the given software lock by the given core, wherein the other cores also attempt to lock the hardware lock prior to attempting to lock the given software lock, and not allowing the other cores to lock the given software lock while the hardware lock is held by the given core; and when the given software lock is locked successfully by the given core, releasing the hardware lock by the given core; when the attempt to lock the hardware lock by the given core is not successful, the given core responds by not accessing the data structure, wherein other than the given core, no other core is allowed to access the data structure from when the hardware is locked until the hardware lock is released by the given core, the data structure comprises a hierarchy of sets of software locks comprising a first set of software locks and a second set of software locks, the given software lock is included in the second set of software locks, and the second set of software locks is accessed by the given core only after obtaining access to another software lock in the first set of software locks; and after the hardware lock is released by the given core, when another core is to lock the given software lock, the other core locks the hardware lock to obtain exclusive access to the data structure, and does not lock the given software lock as a result of the existing lock of the given software lock created by the given core.