Scalable and lock-free first-in-first-out queue implementation
First Claim
Patent Images
1. A method, comprising:
- using a computer to perform;
providing a shared first-in-first-out (FIFO) queue that includes a central queue and an elimination data structure, wherein the elimination data structure comprises one or more entries each indicating an enqueue or dequeue operation to attempt to eliminate as part of an enqueue-dequeue operation pair;
receiving a request for an enqueue operation that would add an element to the FIFO queue or a dequeue operation that would remove an element from the FIFO queue;
in response to said receiving, dynamically determining whether to allow access to the central queue to add an element to or remove an element from the central queue as specified by the request, or to attempt elimination of an enqueue-dequeue operation pair comprising the requested enqueue or dequeue operation, wherein attempting elimination comprises;
updating one or more entries of the elimination data structure; and
examining one or more entries of the elimination data structure in an attempt to locate a corresponding enqueue or dequeue operation with which to form the enqueue-dequeue operation pair;
wherein said determining comprises determining whether the elimination would result in invalid behavior for the FIFO queue; and
allowing access to the central queue or attempting elimination without accessing the central queue, dependent on results of said determining.
2 Assignments
0 Petitions
Accused Products
Abstract
A scalable first-in-first-out queue implementation adjusts to load on a host system. The scalable FIFO queue implementation is lock-free and linearizable, and scales to large numbers of threads. The FIFO queue implementation includes a central queue and an elimination structure for eliminating enqueue-dequeue operation pairs. The elimination mechanism tracks enqueue operations and/or dequeue operations and eliminates without synchronizing on the FIFO queue implementation.
36 Citations
61 Claims
-
1. A method, comprising:
using a computer to perform; providing a shared first-in-first-out (FIFO) queue that includes a central queue and an elimination data structure, wherein the elimination data structure comprises one or more entries each indicating an enqueue or dequeue operation to attempt to eliminate as part of an enqueue-dequeue operation pair; receiving a request for an enqueue operation that would add an element to the FIFO queue or a dequeue operation that would remove an element from the FIFO queue; in response to said receiving, dynamically determining whether to allow access to the central queue to add an element to or remove an element from the central queue as specified by the request, or to attempt elimination of an enqueue-dequeue operation pair comprising the requested enqueue or dequeue operation, wherein attempting elimination comprises; updating one or more entries of the elimination data structure; and examining one or more entries of the elimination data structure in an attempt to locate a corresponding enqueue or dequeue operation with which to form the enqueue-dequeue operation pair;
wherein said determining comprises determining whether the elimination would result in invalid behavior for the FIFO queue; andallowing access to the central queue or attempting elimination without accessing the central queue, dependent on results of said determining. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
-
16. A computer-readable storage medium storing program instructions computer-executable to:
-
instantiate a lock-free linearizable shared first-in-first-out (FIFO) queue in a shared memory, wherein the FIFO queue includes; a central queue; and an elimination data structure, wherein the elimination data structure comprises one or more entries each indicating an enqueue operation that would add an element to the FIFO queue or a dequeue operation that would remove an element from the FIFO queue; and form enqueue-dequeue operation pairs that can be eliminated without enqueueing or dequeueing elements from the central queue, wherein each pair comprises at least one entry of the elimination data structure. - View Dependent Claims (17, 18, 19, 20, 21, 22)
-
-
23. A method, comprising:
-
using a computer to perform; mediating concurrent access to a shared first-in-first-out (FIFO) queue, said mediating comprising; in response to receiving a request for an enqueue operation that would add an element to the FIFO queue or a dequeue operation that would remove an element from the FIFO queue, determining whether sufficient operations exist for the shared FIFO queue to allow elimination of an enqueue-dequeue operation pair comprising the requested enqueue or dequeue operation; and eliminating the enqueue-dequeue operation pair if the sufficient operations have been performed; wherein said determining is dependent on contents of an elimination data structure that is included in the FIFO queue and that comprises one or more entries each indicating an enqueue or dequeue operation on the FIFO queue to attempt to eliminate as part of an enqueue-dequeue operation pair. - View Dependent Claims (24, 25, 26, 27, 28, 29)
-
-
30. A method comprising:
using a computer to perform; tracking enqueue and dequeue operations attempting to access a central queue of a shared first-in-first-out (FIFO) queue, wherein the FIFO queue also includes an elimination data structure, wherein the elimination data structure comprises one or more entries, and wherein each entry indicates an enqueue or dequeue operation to attempt to eliminate as part of an enqueue-dequeue operation pair; determining whether elimination of an enqueue-dequeue operation pair comprising an enqueue operation attempting to add a given value to the FIFO queue and a dequeue operation attempting to remove the given value from the FIFO queue is allowable, wherein the elimination data structure comprises at least one operation of the enqueue-dequeue operation pair, and wherein said determining is dependent on the tracking; and in response to determining that elimination is allowable, attempting elimination of the enqueue-dequeue operation pair, wherein said attempting elimination comprises updating one or more entries of the elimination data structure. - View Dependent Claims (31, 32, 33, 34, 35, 36, 37, 38, 39, 40)
-
41. A computer program product encoded on one or more machine-readable media, the computer program product comprising:
-
a first functional sequence executable to determine, in response to receiving a request for an enqueue operation that would add an element to a shared first-in-first-out (FIFO) or a dequeue operation that would remove an element from the FIFO queue, whether to access a central queue of the FIFO queue to add an element to or remove an element from the central queue as specified by the request, or to attempt elimination of an enqueue-dequeue operation pair comprising the requested enqueue or dequeue operation; a second functional sequence executable to associate a first value with a second value, wherein the first value comprises a value to be enqueued, and wherein the second value is usable in determining whether elimination of the enqueue-dequeue operation pair is allowable; and a third functional sequence executable to attempt elimination of the enqueue-dequeue operation pair in accordance with the determination by the first functional sequence; wherein said determining is dependent on contents of an elimination data structure comprising one or more entries; wherein each entry indicates an enqueue or dequeue operation on the FIFO queue to attempt to eliminate as part of an enqueue-dequeue operation pair; and wherein attempting elimination comprises updating one or more entries of the elimination data structure. - View Dependent Claims (42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54)
-
-
55. A system, comprising:
-
a computer-readable storage medium storing a set of one or more store elements operable to host a scalable lock-free first-in-first-out (FIFO) queue, wherein the FIFO queue includes a central queue and an elimination data structure, and wherein the elimination data structure comprises one or more entries each indicating an enqueue or dequeue operation to attempt to eliminate as part of an enqueue-dequeue operation pair; and means for controlling access to the FIFO queue by linearizable enqueue operations that would add an element to the FIFO queue and dequeue operations that would remove an element from the FIFO queue dependent on load on the system, wherein said controlling access comprises determining whether to attempt to eliminate the linearizable operations in enqueue-dequeue operation pairs or to access the FIFO queue to add elements thereto or remove elements therefrom, in accordance with the system load; and means for attempting elimination of enqueue-dequeue operations pairs, wherein attempting elimination comprises updating one or more entries of the elimination data structure. - View Dependent Claims (56, 57)
-
-
58. A computer readable storage medium storing program instructions computer-executable to implement:
a first-in-first-out (FIFO) queue, wherein the FIFO queue comprises; a central queue for values to be enqueued therein and dequeued therefrom, wherein each element of the central queue indicates a value that has been enqueued and an associated enqueue order value; and an elimination data structure comprising one or more entries to attempt to eliminate as part of an enqueue-dequeue operation pair, wherein each entry indicates an enqueue operation that would add an element to the FIFO queue or dequeue operation that would remove an element from the FIFO queue, and wherein attempting elimination comprises updating one or more entries of the elimination data structure. - View Dependent Claims (59, 60, 61)
Specification