A Lazy Concurrent List-Based Set Algorithm

  • Steve Heller
  • Maurice Herlihy
  • Victor Luchangco
  • Mark Moir
  • William N. SchererIII
  • Nir Shavit
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3974)

Abstract

List-based implementations of sets are a fundamental building block of many concurrent algorithms. A skiplist based on the lock-free list-based set algorithm of Michael will be included in the JavaTM Concurrency Package of JDK 1.6.0. However, Michael’s lock-free algorithm has several drawbacks, most notably that it requires all list traversal operations, including membership tests, to perform cleanup operations of logically removed nodes, and that it uses the equivalent of an atomically markable reference, a pointer that can be atomically “marked,” which is expensive in some languages and unavailable in others.

We present a novel “lazy” list-based implementation of a concurrent set object. It is based on an optimistic locking scheme for inserts and removes, eliminating the need to use the equivalent of an atomically markable reference. It also has a novel wait-free membership test operation (as opposed to Michael’s lock-free one) that does not need to perform cleanup operations and is more efficient than that of all previous algorithms.

Empirical testing shows that the new lazy-list algorithm consistently outperforms all known algorithms, including Michael’s lock-free algorithm, throughout the concurrency range. At high load, with 90% membership tests, the lazy algorithm is more than twice as fast as Michael’s. This is encouraging given that typical search structure usage patterns include around 90% membership tests. By replacing the lock-free membership test of Michael’s algorithm with our new wait-free one, we achieve an algorithm that slightly outperforms our new lazy-list (though it may not be as efficient in other contexts as it uses Java’s RTTI mechanism to create pointers that can be atomically marked).

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bayer, R., Schkolnick, M.: Concurrency of operations on b-trees. Acta Informatica 9, 1–21 (1977)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Eckel, B.: Thinking in Java, 2nd edn. Pearson Education (2000)Google Scholar
  3. 3.
    Harris, T.: A pragmatic implementation of non-blocking linked-lists. In: Welch, J.L. (ed.) DISC 2001. LNCS, vol. 2180, pp. 300–314. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  4. 4.
    Herlihy, M.: Wait-free synchronization. ACM Transactions on Programming Languages and Systems 13(1), 124–149 (1991)CrossRefGoogle Scholar
  5. 5.
    Herlihy, M., Luchangco, V., Moir, M.: The repeat offender problem: A mechanism for supporting lock-free dynamic-sized data structures. In: Proceedings of the 16th International Symposium on Distributed Computing, vol. 2508, pp. 339–353. Springer, Heidelberg (2002)Google Scholar
  6. 6.
    Herlihy, M., Wing, J.: Linearizability: A correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems 12(3), 463–492 (1990)CrossRefGoogle Scholar
  7. 7.
    Lea, D.: Personal communicationGoogle Scholar
  8. 8.
    Lea, D.: Concurrent Programming in Java(TM): Design Principles and Patterns, 2nd edn. Addison-Wesley, Reading (1999)Google Scholar
  9. 9.
    Maier, C.: Hello Laziness: Why Hard Work Doesn’t Pay. Orion, London (2005)Google Scholar
  10. 10.
    Michael, M.: High performance dynamic lock-free hash tables and list-based sets. In: Proceedings of the fourteenth annual ACM symposium on Parallel algorithms and architectures, pp. 73–82. ACM Press, New York (2002)Google Scholar
  11. 11.
    Michael, M.: Safe memory reclamation for dynamic lock-free objects using atomic reads and writes. In: The 21st Annual ACM Symposium on Principles of Distributed Computing, pp. 21–30. ACM Press, New York (2002)Google Scholar
  12. 12.
    Moir, M., Shavit, N.: Chapter 47 – Concurrent Data Structures – Handbook of Data Structures and Applications, 1st edn. Chapman and Hall/CRC (2004)Google Scholar
  13. 13.
    Vafeiadis, V., Herlihy, M., Hoare, T., Shapiro, M.: Proving correctness of highly-concurrent linearisable objects. Technical report, Microsoft Research, Cambridge, UK (2005)Google Scholar
  14. 14.
    Valois, J.: Lock-free linked lists using compare-and-swap. In: ACM Symposium on Principles of Distributed Computing, pp. 214–222 (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Steve Heller
    • 1
  • Maurice Herlihy
    • 2
  • Victor Luchangco
    • 1
  • Mark Moir
    • 1
  • William N. SchererIII
    • 3
  • Nir Shavit
    • 1
  1. 1.Sun Microsystems LaboratoriesUSA
  2. 2.Brown UniversityUSA
  3. 3.University of RochesterUSA

Personalised recommendations