US 7,539,849 B1
Maintaining a double-ended queue in a contiguous array with concurrent non-blocking insert and remove operations using a double compare-and-swap primitive
Nir N. Shavit, Cambridge, Mass. (US); Ole Agesen, Needham, Mass. (US); David L. Detlefs, Westford, Mass. (US); Christine H. Flood, Westford, Mass. (US); Alexander T. Garthwaite, Beverly, Mass. (US); Paul A. Martin, Arlington, Mass. (US); and Guy L. Steele, Jr., Lexington, Mass. (US)
Assigned to Sun Microsystems, Inc., Santa Clara, Calif. (US)
Filed on Apr. 11, 2000, as Appl. No. 9/547,288.
Claims priority of provisional application 60/177089, filed on Jan. 20, 2000.
Int. Cl. G06F 7/06 (2006.01)
U.S. Cl. 712—202  [707/101] 39 Claims
OG exemplary drawing
 
1. A computer implemented method performed on a processor, the computer implemented method comprising:
obtaining a circular array comprising a first data item stored in a first location, a second data item stored in a second location immediately following the first location, and a third data item stored in a third location immediately following the second location;
obtaining a front counter indexing a front location immediately following the third location and a back counter indexing a back location immediately before the first location;
executing a first pop back instruction using a first double compare and swap (DCAS) operation to remove the first data item from the circular array, place a null value in the first location, and change the back counter to index the first location;
executing a first pop front instruction using a second DCAS operation to remove the third data item from the circular array, place the null value in the third location of the circular array, and change the front counter to index the third location; and
executing a second pop front instruction without reading the back counter after executing the first pop back instruction and the first pop front instruction.