Single-word lock-free reference counting
First Claim
1. A lock-free method of managing storage reclamation in a multi-threaded computation, the method comprising:
- maintaining respective reference counts for storage blocks of a data structure shared amongst threads of the multi-threaded computation; and
accessing pointers to the storage blocks using pointer operations to coordinate modification of the respective reference counts, wherein as a condition precedent to dereferencing a particular pointer loaded from the shared data structure, at least one of the pointer operations ensures that (i) an indication is made that one of the threads intends to dereference the particular pointer and (ii) the indication is sufficient to prevent freeing of a particular storage block referenced by the particular pointer.
2 Assignments
0 Petitions
Accused Products
Abstract
Solutions to a value recycling problem that we define herein facilitate implementations of computer programs that may execute as multithreaded computations in multiprocessor computers, as well as implementations of related shared data structures. Some exploitations of the techniques described herein allow non-blocking, shared data structures to be implemented using standard dynamic allocation mechanisms (such as malloc and free). A class of general solutions to value recycling is described in the context of an illustration we call the Repeat Offender Problem (ROP), including illustrative Application Program Interfaces (APIs) defined in terms of the ROP terminology. Furthermore, specific solutions, implementations and algorithm, including a Pass-The-Buck (PTB) implementation are also described. Solutions to the proposed value recycling problem have a variety of uses. For example, a single-word lock-free reference counting (SLFRC) technique may build on any of a variety of value recycling solutions to transform, in a straight-forward manner, many lock-free data structure implementations that assume garbage collection (i.e., which do not explicitly free memory) into dynamic-sized data structures.
50 Citations
41 Claims
-
1. A lock-free method of managing storage reclamation in a multi-threaded computation, the method comprising:
-
maintaining respective reference counts for storage blocks of a data structure shared amongst threads of the multi-threaded computation; and accessing pointers to the storage blocks using pointer operations to coordinate modification of the respective reference counts, wherein as a condition precedent to dereferencing a particular pointer loaded from the shared data structure, at least one of the pointer operations ensures that (i) an indication is made that one of the threads intends to dereference the particular pointer and (ii) the indication is sufficient to prevent freeing of a particular storage block referenced by the particular pointer. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
-
-
20. An implementation of a shared data structure comprising:
-
plural component blocks of dynamically-allocated shared storage; and access operations that, prior to attempting creation or replication of a pointer to any of the component blocks, increment a corresponding reference count, and upon failure of the attempt, thereafter decrement the corresponding reference count, the access operations decrementing a particular reference count, except when handling a pointer creation failure, no earlier than upon destruction of a pointer to a corresponding one of the component blocks, wherein as a condition precedent to dereferencing a pointer loaded from the shared data structure, a guard is posted on the loaded pointer sufficient to prevent freeing of a particular one of the component blocks referenced by the loaded pointer. - View Dependent Claims (21, 22, 23, 24, 25, 26, 27)
-
-
28. A method of transforming an implementation of a shared data structure from garbage collection (GC-) dependent to GC-independent form, the method comprising:
-
associating a reference count with each shared object instance; modifying the implementation, if necessary, to ensure cycle-free garbage; replacing pointer accesses in the implementation with corresponding lock-free, reference-count-maintaining counterpart operations, wherein at least one of the counterpart operations ensures that, as a condition precedent to dereferencing a particular pointer loaded from the shared data structure, (i) a guard is posted on the particular pointer and (ii) the posting is sufficient to prevent freeing of a particular storage block referenced by the particular pointer. - View Dependent Claims (29, 30, 31, 32, 33, 34)
-
-
35. A computer-readable storage medium, comprising:
-
a representation of a shared object that is instantiable as zero or more component objects in dynamically-allocated shared storage of a multiprocessor; and an instruction sequence executable by at least one thread of a computation by the multiprocessor, the instruction sequence including at least one access operation on the shared object and employing one or more lock-free pointer operations to maintain reference counts for one or more accessed component objects thereof, wherein at least one of the lock-free pointer operations ensures that, as a condition precedent to dereferencing a particular pointer loaded from the shared data structure, (i) a guard is posted on the particular pointer and (ii) the posting is sufficient to prevent freeing of a particular storage block referenced by the particular pointer. - View Dependent Claims (36, 37, 38, 39)
-
-
40. An apparatus, comprising:
-
a plurality of processors; one or more stores addressable by the plurality of processors; one or more shared pointer variables accessible by each of the plurality of processors for referencing a shared object encoded in the one or more stores; means for coordinating competing accesses to the shared object using one or more reference counts and one or more lock-free pointer operations that employ a value recycling solution free of multi-target synchronization constructs; and means for ensuring that, as a condition precedent to dereferencing a particular pointer loaded from the shared object, (i) a guard is posted on the particular pointer and (ii) the posting is sufficient to prevent freeing of a particular storage block referenced by the particular pointer. - View Dependent Claims (41)
-
Specification