Method and computer program product for reducing lock contention in a multiple instruction execution stream processing environment
First Claim
1. In a computing environment containing a database, wherein an object contained in a portion of the database may be accessed by multiple streams of executable instructions, wherein a reference count technique is used to track use of the object by the multiple streams, and wherein access to the portion of the database and therefore access to the object is controlled by a global lock that must be acquired by an executable stream in order to use the object, a computer program product for reducing lock contention for the global lock between the multiple streams of executable instructions that require use of the object, said lock contention causing wasted CPU processing cycles which otherwise occur when a stream is waiting to acquire the global lock when the global lock is already in use by a different stream, said computer program product reducing lock contention by minimizing excess global lock acquisitions without constraints in global lock acquisitions with other locks, the computer program product comprising:
- a computer-readable medium; and
computer-executable instructions contained on said computer-readable medium for performing the following;
a specific act of assigning to the object a first reference count and a second reference count;
a specific act of selecting a lock to control access to the second reference count;
a specific act of when a stream of executable instructions seeks to use the object, while the global lock is held, locating the object in the database and incrementing the first reference count assigned to the object; and
a specific act of after the stream of executable instructions is finished using the object, while the selected lock is held, incrementing the second reference count assigned to the object and comparing the first and second reference counts assigned to the object, and if the first and second reference counts are equal, deleting the object and releasing the selected lock if necessary at some point after the comparison is made between the first and second reference counts.
2 Assignments
0 Petitions
Accused Products
Abstract
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.
49 Citations
22 Claims
-
1. In a computing environment containing a database, wherein an object contained in a portion of the database may be accessed by multiple streams of executable instructions, wherein a reference count technique is used to track use of the object by the multiple streams, and wherein access to the portion of the database and therefore access to the object is controlled by a global lock that must be acquired by an executable stream in order to use the object, a computer program product for reducing lock contention for the global lock between the multiple streams of executable instructions that require use of the object, said lock contention causing wasted CPU processing cycles which otherwise occur when a stream is waiting to acquire the global lock when the global lock is already in use by a different stream, said computer program product reducing lock contention by minimizing excess global lock acquisitions without constraints in global lock acquisitions with other locks, the computer program product comprising:
-
a computer-readable medium; and computer-executable instructions contained on said computer-readable medium for performing the following; a specific act of assigning to the object a first reference count and a second reference count; a specific act of selecting a lock to control access to the second reference count; a specific act of when a stream of executable instructions seeks to use the object, while the global lock is held, locating the object in the database and incrementing the first reference count assigned to the object; and a specific act of after the stream of executable instructions is finished using the object, while the selected lock is held, incrementing the second reference count assigned to the object and comparing the first and second reference counts assigned to the object, and if the first and second reference counts are equal, deleting the object and releasing the selected lock if necessary at some point after the comparison is made between the first and second reference counts. - View Dependent Claims (2, 3)
-
-
4. In a computing environment having multiple streams of executable instructions that operate on objects organized in a database structure, wherein an object is contained in a portion of the database structure, wherein a global lock controls access to at least the portion of the database structure and thereby controls access to the object, a method for reducing lock contention for the global lock between the multiple streams of executable instructions that require use of the object, said lock contention causing wasted CPU processing cycles, the method comprising the following:
-
a specific act of assigning to the object a first reference count and a second reference count; a specific act of using the global lock to control write-access to the first reference count on the object; a specific act of using a selected lock to control write-access for the second reference count on the object; and when a stream of executable instructions accesses the database structure to use the object; a specific act of while holding the global lock, incrementing the first reference count for the object if the object is found so that the first reference count is incremented each time a stream of executable instructions is processing the object; a specific act of processing the object as necessary; a specific act of while holding the selected lock, incrementing the second reference count for the object to indicate that the stream of executable instructions is no longer processing the object so that acquisition of the global lock is unnecessary to complete processing of the object; a specific act of while holding the selected lock, comparing the first reference count with the second reference count; and a specific act of if the first reference count and the second reference count are equal, destroying the object. - View Dependent Claims (5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. In a computing environment having multiple streams of executable instructions that operate on objects organized in a database structure, wherein each object has a first reference count, a second reference count, and is contained in a portion of the database structure, wherein a global lock controls access to at least the portion of the database structure containing a desired object, wherein the global lock also controls write-access to the first reference count, and wherein another lock is selected to control write access to the second reference count, a method for reducing lock contention for the global lock between the multiple streams of executable instructions that require use of the object, said lock contention causing wasted CPU processing cycles, the method comprising the steps of:
-
while holding the global lock, incrementing the first reference count for the object if the object is found so that the first reference count is incremented each time a stream of executable instructions is processing the object; processing the object as necessary; while holding the selected lock, incrementing the second reference count for the object to indicate that the stream of executable instructions is no longer processing the object so that acquisition of the global lock is unnecessary to complete processing of the object; while holding the selected lock, comparing the first reference count with the second reference count; and if the first reference count and the second reference count are equal, destroying the object. - View Dependent Claims (14, 15, 16, 17, 18, 19)
-
-
20. In a computing environment containing a database, wherein a data structure contained in a portion of the database may be accessed by multiple streams of executable instructions, wherein a reference count technique is used to track use of the data strucutre by the multiple streams, and wherein access to the portion of the database and therefore access to the data structure is controlled by a global lock that must be acquired by an executable stream in order to use the data structure, a computer program product for reducing lock contention for the global lock between the multiple streams of executable instructions that require use of the data structure, said lock contention causing wasted CPU processing cycles which otherwise occur when a stream is waiting to acquire the global lock when the global lock is already in use by a different stream, said computer program product reducing lock contention by minimizing excess global lock acquisitions without constraints in global lock acquisitions with other locks, the computer program product comprising a computer-readable medium having stored thereon the data structure, wherein the data structure comprises:
-
a first data field containing data representing a positive reference count that may be initialized in response to creating the data structure and that is only incremented when a stream of executable instructions using the data structure is holding the global lock, the global lock controlling write-access to the first data field; and a second data field containing data representing a negative reference count that may only be incremented when holding a selected lock that is different than the global lock and in response to deleting the data structure or when a stream of executable instructions is finished using the data structure, the selected lock controlling write-access to the second data field, wherein after processing the data structure, the first data field and the second data field are compared to determine whether or not they are equivalent, and if equivalent, the data structure is destroyed. - View Dependent Claims (21, 22)
-
Specification