Patent ID: 7444634

Claim:
A method for applying a dynamic lock to a range of a resource within a computer system, comprising: receiving a request to lock to the range of the resource from a thread in the computer system, wherein the range of the resource is a portion of the resource; examining an active lock pool to determine if the range of the resource is currently locked, wherein the active lock pool is organized as a hash table and wherein examining the active lock pool involves performing a hash lookup into the active lock pool based on the range of the resource, if the hash lookup returns an active lock, determining whether the active lock is associated with the range of the resource by retrieving resource information from the active lock and comparing the resource information with the range of the resource; and if the range of the resource is not currently locked, retrieving the dynamic lock from a free lock pool, setting resource information in the dynamic lock so that the dynamic lock is associated with the range of the resource, setting owner information in the dynamic lock so that the dynamic lock is associated with the thread that is requesting the dynamic lock, and adding the dynamic lock to the active lock pool; whereby locking the range of the resource protects the locked portion of the resource without preventing other threads from locking and accessing other portions of the resource.