A Practical Multi-word Compare-and-Swap Operation

  • Timothy L. Harris
  • Keir Fraser
  • Ian A. Pratt
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2508)

Abstract

Work on non-blocking data structures has proposed extending processor designs with a compare-and-swap primitive, CAS2, which acts on two arbitrary memory locations. Experience suggested that current operations, typically single-word compare-and-swap (CAS1), are not expressive enough to be used alone in an efficient manner. In this paper we build CAS2 from CAS1 and, in fact, build an arbitrary multi-word compare-and-swap (CASN). Our design requires only the primitives available on contemporary systems, reserves a small and constant amount of space in each word updated (either 0 or 2 bits) and permits nonoverlapping updates to occur concurrently. This provides compelling evidence that current primitives are not only universal in the theoretical sense introduced by Herlihy, but are also universal in their use as foundations for practical algorithms. This provides a straightforward mechanism for deploying many of the interesting non-blocking data structures presented in the literature that have previously required CAS2.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    S. V. Adve and K. Gharachorloo. Shared memory consistency models: a tutorial. IEEE Computer, 29(12):66–76, Dec. 1996.Google Scholar
  2. 2.
    J. H. Anderson and M. Moir. Universal constructions for multi-object operations. In Proc. 14th PODC, pp 184–193, Aug. 1995.Google Scholar
  3. 3.
    J. H. Anderson, S. Ramamurthy, and R. Jain. Implementing wait-free objects on priority-based systems. In Proc. 16th PODC, pp 229–238, Aug. 1997.Google Scholar
  4. 4.
    D. L. Detlefs, C. H. Flood, A. T. Garthwaite, P. A. Martin, N. N. Shavit, and G. L. Steele Jr. Even better DCAS-based concurrent deques. In Proc. 14th DISC, LNCS 1914, pp 59–73, Oct. 2000.Google Scholar
  5. 5.
    M. Greenwald. Non-blocking synchronization and system design. PhD thesis, Stanford University, Aug. 1999.Google Scholar
  6. 6.
    T. L. Harris. A pragmatic implementation of non-blocking linked lists. In Proc. 15th DISC, LNCS 2180, pp 300–314, Oct. 2001.Google Scholar
  7. 7.
    M. Herlihy. A methodology for implementing highly concurrent data objects. ACM TOPLAS, 15(5):745–770, Nov. 1993.Google Scholar
  8. 8.
    M. Herlihy, V. Luchangco, and M. Moir The repeat offender problem: a mechanism for supporting dynamic-sized, lock-free data structures. In Proc. 16th DISC, 2002.Google Scholar
  9. 9.
    G. J. Holzmann. The model checker SPIN. IEEE Transactions on Software Engineering, 23(5):279–295, May 1997.Google Scholar
  10. 10.
    A. Israeli and L. Rappoport. Disjoint-access-parallel implementations of strong shared memory primitives. In Proc. 13th PODC, pp 151–160, Aug. 1994.Google Scholar
  11. 11.
    H. Massalin and C. Pu. A lock-free multiprocessor OS kernel. Technical Report CUCS-005-91, Columbia University, Department of Computer Science, June 1991.Google Scholar
  12. 12.
    J. M. Mellor-Crummey and M. L. Scott. Algorithms for scalable synchronization on shared-memory multiprocessors. ACM TOCS, 9(1):21–65, Feb. 1991.Google Scholar
  13. 13.
    M. M. Michael. Safe memory reclamation for dynamic lock-free objects using atomic reads and writes. In Proc. 21st PODC, July 2002.Google Scholar
  14. 14.
    M. Moir. Practical implementations of non-blocking synchronization primitives. In Proc. 16th PODC, pp 219–228, Aug. 1997.Google Scholar
  15. 15.
    M. Moir. Transparent support for wait-free transactions. In Distributed Algorithms, 11th International Workshop, LNCS 1320, pp 305–319, Sept. 1997.CrossRefGoogle Scholar
  16. 16.
    N. N. Shavit and D. Touitou. Software transactional memory. In Proc. 14th PODC, pp 204–213, Aug. 1995.Google Scholar
  17. 17.
    J. D. Valois. Lock-free linked lists using compare-and-swap. In Proc. 14th PODC pp 214–222, Aug. 1995.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Timothy L. Harris
    • 1
  • Keir Fraser
    • 1
  • Ian A. Pratt
    • 1
  1. 1.University of Cambridge Computer LaboratoryCambridgeUK

Personalised recommendations