A method, computer program product, and data structure for reducing the
contention for a global lock that impairs system efficiency. An object is
assigned or has thereon a positive reference count and a negative
reference count. Upon creation, the positive reference count is
incremented to indicate creation and the object is placed in a global data
structure. When a process thread or other stream of executable
instructions initially accesses the data object, the global lock is
acquired and the positive reference count incremented to indicate the
object is being used. When a process thread or other stream of executable
instructions finishes processing the object, an object lock or other
assigned lock is acquired (if not already held) and the negative reference
count is incremented to indicate that the object is no longer in use by
that particular process thread. Upon deletion, the negative reference
count is incremented and will now be equivalent with the positive
reference count if no process threads are still using the object. The
object is destroyed when the positive reference count and the negative
reference count are equivalent. The test for when the object should be
destroyed occurs at the end of normal use processing as well as deletion
processing since the object will not be destroyed until all process
threads or other streams of executable instructions have finished their
processing. Since the global lock need not be acquired a second time upon
finishing processing, excessive global lock acquisition is reduced so that
less lock contention occurs.