Method and apparatus for implementing a fully dynamic lock-free hash table
First Claim
Patent Images
1. A method for using a hash table that is fully dynamic and lock-free, comprising:
- performing a lookup into the hash table, wherein the lookup involves,using a hash key to lookup a bucket pointer in a bucket array,following the bucket pointer to a data node within a linked list containing all of the data nodes in the hash table, andsearching from the data node through the linked list to locate a node that matches the hash key if one exists;
wherein the linked list contains only data nodes and at most a constant number of dummy nodes; and
when the average number of data nodes in each bucket exceeds a maximum value;
increasing the number of buckets in the bucket array to form a larger bucket array, andusing more bits from the hash key to perform lookups in the larger bucket array,wherein the data nodes are stored in the linked list in bit-inverted hash key order, andwherein increasing the number of buckets in the bucket array involves copying the existing bucket array into the top half of the larger bucket array through a single pointer operation.
2 Assignments
0 Petitions
Accused Products
Abstract
One embodiment of the present invention provides a system that implements a hash table that is fully dynamic and lock-free. During a lookup in the hash table the system first uses a hash key to lookup a bucket pointer in a bucket array. Next, the system follows the bucket pointer to a data node within a linked list that contains all of the data nodes in the hash table, wherein the linked list contains only data nodes and at most a constant number of dummy nodes. The system then searches from the data node through the linked list to locate a node that matches the hash key, if one exists.
72 Citations
36 Claims
-
1. A method for using a hash table that is fully dynamic and lock-free, comprising:
-
performing a lookup into the hash table, wherein the lookup involves, using a hash key to lookup a bucket pointer in a bucket array, following the bucket pointer to a data node within a linked list containing all of the data nodes in the hash table, and searching from the data node through the linked list to locate a node that matches the hash key if one exists; wherein the linked list contains only data nodes and at most a constant number of dummy nodes; and when the average number of data nodes in each bucket exceeds a maximum value; increasing the number of buckets in the bucket array to form a larger bucket array, and using more bits from the hash key to perform lookups in the larger bucket array, wherein the data nodes are stored in the linked list in bit-inverted hash key order, and wherein increasing the number of buckets in the bucket array involves copying the existing bucket array into the top half of the larger bucket array through a single pointer operation. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for using a hash table that is fully dynamic and lock-free, wherein the computer-readable storage medium does not include computer instruction signals embodied in a transmission medium, and wherein the method comprising:
-
performing a lookup into the hash table, wherein the lookup involves, using a hash key to lookup a bucket pointer in a bucket array, following the bucket pointer to a data node within a linked list containing all of the data nodes in the hash table, and searching from the data node through the linked list to locate a node that matches the hash key if one exists; wherein the linked list contains only data nodes and at most a constant number of dummy nodes; and when the average number of data nodes in each bucket exceeds a maximum value; increasing the number of buckets in the bucket array to form a larger bucket array, and using more bits from the hash key to perform lookups in the larger bucket array, wherein the data nodes are stored in the linked list in bit-inverted hash key order, and wherein increasing the number of buckets in the bucket array involves copying the existing bucket array into the top half of the larger bucket array through a single pointer operation. - View Dependent Claims (14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)
-
-
25. An apparatus that implements a hash table that is fully dynamic and lock-free, comprising:
-
a lookup mechanism, wherein the lookup mechanism is configured to, use a hash key to lookup a bucket pointer in a bucket array, follow the bucket pointer to a data node within a linked list containing all of the data nodes in the hash table, and to search from the data node through the linked list to locate a node that matches the hash key if one exists; wherein the linked list contains only data nodes and at most a constant number of dummy nodes; and a bucket array expansion mechanism, wherein when the average number of data nodes in each bucket exceeds a maximum value, the bucket array expansion mechanism is configured to; increase the number of buckets in the bucket array to form a larger bucket array, and to use additional bits from the hash key to perform lookups in the larger bucket array, wherein the data nodes are stored in the linked list in bit-inverted hash key order, and wherein the bucket array expansion mechanism is configured to copy the existing bucket array into the top half of the larger bucket array through a single pointer operation. - View Dependent Claims (26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36)
-
Specification