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.
Similar content being viewed by others
References
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)
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
Attiya, H., Dagan, E.: Universal operations: Unary versus binary. In: Proc. 15th Annual ACM Symposium on Principles of Distributed Computing, May 1996
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
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
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)
Ellen, F.: Personal communication (2003)
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
Greenwald, M.: Non-blocking synchronization and system design. PhD thesis, Stanford University. Technical Report STAN-CS-TR-99-1624, August 1999
Harris, T.: A pragmatic implementation of non-blocking linked lists. In: Proc. 15th International Symposium on Distributed Computing (2001)
Harris, T.: Personal communication, December 2002
Harris, T., Fraser, K., Pratt, I.: A practical multi-word compare-and-swap operation. In: Proc. 16th International Symposium on Distributed Computing (2002)
Herlihy, M.: Wait-free synchronization. ACM Trans. Program. Lang. Syst. 13(1), 124–149 (1991)
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)
Herlihy, M., Wing, J.: Linearizability: A correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990)
Herlihy, M., Luchangco, V., Moir, M.: Obstruction-free software NCAS and transactional memory. Unpublished manuscript (2002)
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)
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)
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)
Intel: Pentium processor family user’s manual: Vol. 3, architecture and programming manual (1994)
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)
Lynch, N., Vaandrager, F.: Forward and backward simulations—part I: Untimed systems. Inf. Comput. 121(2), 214–233 (1995)
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)
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)
Michael, M., Scott, M.: Nonblocking algorithms and preemption-safe locking on multiprogrammed shared memory multiprocessors. J. Parallel Distributed Comput. 51(1), 1–26 (1998)
Moir, M.: Practical implementations of non-blocking synchronization primitives. In: Proc. 16th Annual ACM Symposium on Principles of Distributed Computing, pp. 219–228 (1997)
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)
Motorola: MC68030 User’s Manual. Prentice Hall, New York (1989)
Shavit, N., Touitou, D.: Software transactional memory. Distributed Comput. 10(2), 99–116 (1997)
Sites, R.: Alpha architecture reference manual (1992)
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)
Weaver, D., Germond, T.: The SPARC architecture manual version 9. Prentice Hall, New York (1994)
Author information
Authors and Affiliations
Corresponding author
Additional information
A preliminary version of this paper appeared in the Proceedings of the Fifteenth Annual ACM Symposium on Parallel Algorithms and Architectures, pages 314–323, San Diego, California, USA, 2003.
Rights and permissions
About this article
Cite this article
Luchangco, V., Moir, M. & Shavit, N. Nonblocking k-Compare-Single-Swap. Theory Comput Syst 44, 39–66 (2009). https://doi.org/10.1007/s00224-008-9155-5
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-008-9155-5