Theory of Computing Systems

, Volume 44, Issue 1, pp 39–66

Nonblocking k-Compare-Single-Swap

Article
  • 87 Downloads

Abstract

The current literature offers two extremes of nonblocking software synchronization support for concurrent data structure design: intricate designs of specific structures based on single-location operations such as compare-and-swap (CAS), and general-purpose multilocation transactional memory implementations. While the former are sometimes efficient, they are invariably hard to extend and generalize. The latter are flexible and general, but costly. This paper aims at a middle ground: reasonably efficient multilocation operations that are general enough to reduce the design difficulties of algorithms based on CAS alone.

We present an obstruction-free implementation of an atomic k-location-compare single-location-swap (KCSS) operation. KCSS allows for simple nonblocking manipulation of linked data structures by overcoming the key algorithmic difficulty in their design: making sure that while a pointer is being manipulated, neighboring parts of the data structure remain unchanged. Our algorithm is efficient in the common uncontended case: A successful k-location KCSS operation requires only two CAS operations, two stores, and 2k noncached loads when there is no contention. We therefore believe our results lend themselves to efficient and flexible nonblocking manipulation of list-based data structures in today’s architectures.

Keywords

Shared memory multiprocessors Synchronization Compare-and-swap 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Afek, Y., Attiya, H., Dolev, D., Gafni, E., Merritt, M., Shavit, N.: Atomic snapshots of shared memory. J. Assoc. Comput. Mach. 40(4), 873–890 (1993) MATHGoogle Scholar
  2. 2.
    Agesen, O., Detlefs, D., Flood, C., Garthwaite, A., Martin, P., Moir, M., Shavit, N., Steele, G.: DCAS-based concurrent deques. Theory Comput. Syst. 35, 349–386 (2002). A preliminary version appeared in the Proc. 12th ACM Symposium on Parallel Algorithms and Architectures MATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Attiya, H., Dagan, E.: Universal operations: Unary versus binary. In: Proc. 15th Annual ACM Symposium on Principles of Distributed Computing, May 1996 Google Scholar
  4. 4.
    Barnes, G.: A method for implementing lock-free shared data structures. In: Proc. 5th ACM Symposium on Parallel Algorithms and Architectures, pp. 261–270, June 1993 Google Scholar
  5. 5.
    Detlefs, D., Martin, P., Moir, M., Steele, G.: Lock-free reference counting. Distributed Comput. 15(4), 255–271 (2002). A preliminary version appeared in the Proc. 20th Annual ACM Symposium on Principles of Distributed Computing, 2001 CrossRefGoogle Scholar
  6. 6.
    Doherty, S., Herlihy, M., Luchangco, V., Moir, M.: Bringing practical lock-free synchronization to 64-bit applications. In: Proc. 23rd Annual ACM Symposium on Principles of Distributed Computing, pp. 31–39 (2004) Google Scholar
  7. 7.
    Ellen, F.: Personal communication (2003) Google Scholar
  8. 8.
    Glew, A., Hwu, W.: A feature taxonomy and survey of synchronization primitive implementations. Technical Report CRHC-91-7, University of Illinois at Urbana-Champaign, December 1990 Google Scholar
  9. 9.
    Greenwald, M.: Non-blocking synchronization and system design. PhD thesis, Stanford University. Technical Report STAN-CS-TR-99-1624, August 1999 Google Scholar
  10. 10.
    Harris, T.: A pragmatic implementation of non-blocking linked lists. In: Proc. 15th International Symposium on Distributed Computing (2001) Google Scholar
  11. 11.
    Harris, T.: Personal communication, December 2002 Google Scholar
  12. 12.
    Harris, T., Fraser, K., Pratt, I.: A practical multi-word compare-and-swap operation. In: Proc. 16th International Symposium on Distributed Computing (2002) Google Scholar
  13. 13.
    Herlihy, M.: Wait-free synchronization. ACM Trans. Program. Lang. Syst. 13(1), 124–149 (1991) CrossRefGoogle Scholar
  14. 14.
    Herlihy, M., Moss, J.E.B.: Transactional memory: Architectural support for lock-free data structures. In: Proc. 20th Annual International Symposium on Computer Architecture (1993) Google Scholar
  15. 15.
    Herlihy, M., Wing, J.: Linearizability: A correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990) CrossRefGoogle Scholar
  16. 16.
    Herlihy, M., Luchangco, V., Moir, M.: Obstruction-free software NCAS and transactional memory. Unpublished manuscript (2002) Google Scholar
  17. 17.
    Herlihy, M., Luchangco, V., Moir, M.: Obstruction-free synchronization: Double-ended queues as an example. In: Proc. 23rd International Conference on Distributed Computing Systems, pp. 522–529 (2003) Google Scholar
  18. 18.
    Herlihy, M., Luchangco, V., Moir, M., Scherer, W.: Software transactional memory for supporting dynamic-sized data structures. In: Proc. 22th Annual ACM Symposium on Principles of Distributed Computing, pp. 92–101 (2003) Google Scholar
  19. 19.
    Herlihy, M., Luchangco, V., Martin, P., Moir, M.: Nonblocking memory management support for dynamic-sized data structures. ACM Trans. Comput. Syst. 23(2), 146–196 (2005) CrossRefGoogle Scholar
  20. 20.
    Intel: Pentium processor family user’s manual: Vol. 3, architecture and programming manual (1994) Google Scholar
  21. 21.
    Israeli, A., Rappoport, L.: Disjoint-access-parallel implementations of strong shared memory primitives. In: Proc. 13th Annual ACM Symposium on Principles of Distributed Computing, pp. 151–160 (1994) Google Scholar
  22. 22.
    Lynch, N., Vaandrager, F.: Forward and backward simulations—part I: Untimed systems. Inf. Comput. 121(2), 214–233 (1995) MATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Michael, M.: High performance dynamic lock-free hash tables and list-based sets. In: Proc. 14th Annual ACM Symposium on Parallel Algorithms and Architectures, pp. 73–82 (2002) Google Scholar
  24. 24.
    Michael, M.: Safe memory reclamation for dynamic lock-free objects using atomic reads and writes. IEEE Trans. Parallel Distributed Syst. 15(6), 491–504 (2004) CrossRefGoogle Scholar
  25. 25.
    Michael, M., Scott, M.: Nonblocking algorithms and preemption-safe locking on multiprogrammed shared memory multiprocessors. J. Parallel Distributed Comput. 51(1), 1–26 (1998) MATHCrossRefGoogle Scholar
  26. 26.
    Moir, M.: Practical implementations of non-blocking synchronization primitives. In: Proc. 16th Annual ACM Symposium on Principles of Distributed Computing, pp. 219–228 (1997) Google Scholar
  27. 27.
    Moir, M.: Laziness pays! Using lazy synchronization mechanisms to improve non-blocking constructions. In: Proceedings of the 19th Annual ACM Symposium on the Principles of Distributed Computing, pp. 61–70 (2000) Google Scholar
  28. 28.
    Motorola: MC68030 User’s Manual. Prentice Hall, New York (1989) Google Scholar
  29. 29.
    Shavit, N., Touitou, D.: Software transactional memory. Distributed Comput. 10(2), 99–116 (1997) CrossRefGoogle Scholar
  30. 30.
    Sites, R.: Alpha architecture reference manual (1992) Google Scholar
  31. 31.
    Turek, J., Shasha, D., Prakash, S.: Locking without blocking: Making lock-based concurrent data structure algorithms nonblocking. In: Proc. 11th ACM Symposium on Principles of Database Systems, pp. 212–222 (1992) Google Scholar
  32. 32.
    Weaver, D., Germond, T.: The SPARC architecture manual version 9. Prentice Hall, New York (1994) Google Scholar

Copyright information

© Springer Science+business Media. LLC 2008

Authors and Affiliations

  1. 1.Sun Microsystems LaboratoriesBurlingtonUSA

Personalised recommendations