Skip to main content

Lock-Free Dynamically Resizable Arrays

  • Conference paper
Principles of Distributed Systems (OPODIS 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4305))

Included in the following conference series:

Abstract

We present a first lock-free design and implementation of a dynamically resizable array (vector). The most extensively used container in the C++ Standard Template Library (STL) is vector, offering a combination of dynamic memory management and constant-time random access. Our approach is based on a single 32-bit word atomic compare-and-swap (CAS) instruction. It provides a linearizable and highly parallelizable STL-like interface, lock-free memory allocation and management, and fast execution. Our current implementation is designed to be most efficient on multi-core architectures. Experiments on a dual-core Intel processor with shared L2 cache indicate that our lock-free vector outperforms its lock-based STL counterpart and the latest concurrent vector implementation provided by Intel by a large factor. The performance evaluation on a quad dual-core AMD system with non-shared L2 cache demonstrated timing results comparable to the best available lock-based techniques. The presented design implements the most common STL vector’s interfaces, namely random access read and write, tail insertion and deletion, pre-allocation of memory, and query of the container’s size. Using the current implementation, a user has to avoid one particular ABA problem.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alexandrescu, A., Michael, M.: Lock-free data structures with hazard pointers. C++ User Journal (November 2004)

    Google Scholar 

  2. An, P., Jula, A., Rus, S., Saunders, S., Smith, T., Tanase, G., Thomas, N., Amato, N., Rauchwerger, L.: STAPL: A Standard Template Adaptive Parallel C++ Library. In: LCPC 2001, Cumberland Falls, Kentucky, pp. 193–208(August 2001)

    Google Scholar 

  3. Barnes, G.: A method for implementing lock-free shared-data structures. In: SPAA 1993: Proceedings of the fifth annual ACM symposium on Parallel algorithms and architectures, pp. 261–270. ACM Press, New York (1993)

    Chapter  Google Scholar 

  4. Becker, P.: Working Draft, Standard for Programming Language C++, ISO WG21N2009 (April 2006)

    Google Scholar 

  5. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to algorithms. MIT Press, Cambridge (2001)

    MATH  Google Scholar 

  6. Detlefs, D.L., Flood, C.H., Garthwaite, A.T., Martin, P.A., Shavit, N.N., Steele Jr., G.L.: Even better DCAS-based concurrent deques. In: Herlihy, M.P. (ed.) DISC 2000. LNCS, vol. 1914, pp. 59–73. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  7. Fraser, K.: Practical lock-freedom. Technical Report UCAM-CL-TR-579, University of Cambridge, Computer Laboratory (February 2004)

    Google Scholar 

  8. Garlan, D., Reinholtz, W.K., Schmerl, B., Sherman, N.D., Tseng, T.: Bridging the gap between systems design and space systems software. In: SEW 2005, Washington, DC, USA, pp. 34–46. IEEE Computer Society Press, Los Alamitos (2005)

    Google Scholar 

  9. Gidenstam, A., Papatriantafilou, M., Tsigas, P.: Allocating memory in a lock-free manner. In: Brodal, G.S., Leonardi, S. (eds.) ESA 2005. LNCS, vol. 3669, pp. 329–342. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  10. Harris, T.L.: A pragmatic implementation of non-blocking linked-lists. In: Welch, J.L. (ed.) DISC 2001. LNCS, vol. 2180, pp. 300–314. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  11. Harris, T.L., Fraser, K., Pratt, I.A.: A practical multi-word compare-and-swap operation. In: Malkhi, D. (ed.) DISC 2002. LNCS, vol. 2508. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  12. Hendler, D., Shavit, N., Yerushalmi, L.: A scalable lock-free stack algorithm. In: SPAA 2004: Proceedings of the sixteenth annual ACM symposium on Parallelism in algorithms and architectures, pp. 206–215. ACM Press, New York (2004)

    Chapter  Google Scholar 

  13. Herlihy, M.: A methodology for implementing highly concurrent data objects. ACM Trans. Program. Lang. Syst. 15(5), 745–770 (1993)

    Article  Google Scholar 

  14. 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)

    Article  Google Scholar 

  15. Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990)

    Article  Google Scholar 

  16. Intel. Ia-32 intel architecture software developer’s manual, vol. 3: System programming guide (2004)

    Google Scholar 

  17. Intel. Reference for Intel Threading Building Blocks, version 1.0 (April 2006)

    Google Scholar 

  18. ISO/IEC 14882 International Standard. Programming languages C++. American National Standards Institute (September 1998)

    Google Scholar 

  19. Michael, M.: CAS-Based Lock-Free Algorithm for Shared Deques. In: Kosch, H., Böszörményi, L., Hellwagner, H. (eds.) Euro-Par 2003. LNCS, vol. 2790, pp. 651–660. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  20. Michael, M.M.: High performance dynamic lock-free hash tables and list-based sets. In: SPAA 2002: Proceedings of the fourteenth annual ACM symposium on Parallel algorithms and architectures, pp. 73–82. ACM Press, New York (2002)

    Chapter  Google Scholar 

  21. Michael, M.M.: Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects. IEEE Trans. Parallel Distrib. Syst. 15(6), 491–504 (2004)

    Article  Google Scholar 

  22. Michael, M.M.: Scalable lock-free dynamic memory allocation. In: PLDI 2004: Proceedings of the ACM SIGPLAN 2004 Conf. on Programming language design and implementation, pp. 35–46. ACM Press, New York (2004)

    Chapter  Google Scholar 

  23. Michael, M.M., Scott, M.L.: Correction of a memory management method for lock-free data structures. Technical Report TR599 (1995)

    Google Scholar 

  24. Robison, A.: Intel Corporation. Personal communication (April 2006)

    Google Scholar 

  25. Shalev, O., Shavit, N.: Split-ordered lists: lock-free extensible hash tables. In: PODC 2003: Proceedings of the twenty-second annual symposium on Principles of distributed computing, pp. 102–111. ACM Press, New York (2003)

    Chapter  Google Scholar 

  26. Stroustrup, B.: The C++ Programming Language. Addison-Wesley Longman Publishing Co., Inc., Boston (2000)

    Google Scholar 

  27. Sundell, H., Tsigas, P.: Lock-Free and Practical Doubly Linked List-Based Deques Using Single-Word Compare-and-Swap. In: Higashino, T. (ed.) OPODIS 2004. LNCS, vol. 3544, pp. 240–255. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Dechev, D., Pirkelbauer, P., Stroustrup, B. (2006). Lock-Free Dynamically Resizable Arrays. In: Shvartsman, M.M.A.A. (eds) Principles of Distributed Systems. OPODIS 2006. Lecture Notes in Computer Science, vol 4305. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11945529_11

Download citation

  • DOI: https://doi.org/10.1007/11945529_11

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-49990-9

  • Online ISBN: 978-3-540-49991-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics