skip to main content
research-article

Adaptive lock-free maps: purely-functional to scalable

Published: 29 August 2015 Publication History

Abstract

Purely functional data structures stored inside a mutable variable provide an excellent concurrent data structure—obviously correct, cheap to create, and supporting snapshots. They are not, however, scalable. We provide a way to retain the benefits of these pure-in-a-box data structures while dynamically converting to a more scalable lock-free data structure under contention. Our solution scales to any pair of pure and lock-free container types with key/value set semantics, while retaining lock-freedom. We demonstrate the principle in action on two very different platforms: first in the Glasgow Haskell Compiler and second in Java. To this end we extend GHC to support lock-free data structures and introduce a new approach for safe CAS in a lazy language.

References

[1]
S. Adams. Functional pearls efficient setsa balancing act. Journal of functional programming, 3(04):553–561, 1993.
[2]
S. Bauman, C. F. Bolz, R. Hirschfeld, V. Krilichev, T. Pape, J. Siek, and S. Tobin-Hochstadt. Pycket: A tracing jit for a functional language.
[3]
C. F. Bolz, L. Diekmann, and L. Tratt. Storage strategies for collections in dynamically typed languages. SIGPLAN Not., 48(10):167– 182, Oct. 2013. ISSN 0362-1340. URL http://doi.acm.org/ 10.1145/2544173.2509531.
[4]
J. Cieslewicz, K. A. Ross, K. Satsumi, Y. Ye, and Q. Processing. Automatic contention detection and amelioration for data-intensive operations. In In SIGMOD, 2010.
[5]
T. H. Cormen, C. Stein, R. L. Rivest, and C. E. Leiserson. Introduction to Algorithms. McGraw-Hill Higher Education, 2nd edition, 2001. ISBN 0070131511.
[6]
K. Fraser. Practical lock-freedom. PhD thesis, University of Cambridge, 2004.
[7]
A. Gill and G. Hutton. The worker/wrapper transformation. J. Funct. Program., 19(2):227–251, Mar. 2009. ISSN 0956-7968.
[8]
. URL http://dx.doi.org/10.1017/S0956796809007175.
[9]
J. N. Gray, R. A. Lorie, and G. R. Putzolu. Granularity of locks in a shared data base. In Proceedings of the 1st International Conference on Very Large Data Bases, VLDB ’75, pages 428–451, New York, NY, USA, 1975. ACM. ISBN 978-1-4503-3920-9. URL http: //doi.acm.org/10.1145/1282480.1282513.
[10]
D. Hendler, N. Shavit, and L. Yerushalmi. A scalable lock-free stack algorithm. In Proceedings of the Sixteenth Annual ACM Symposium on Parallelism in Algorithms and Architectures, SPAA ’04, pages 206– 215, New York, NY, USA, 2004. ACM. ISBN 1-58113-840-7. URL http://doi.acm.org/10.1145/1007912.1007944.
[11]
M. Herlihy, Y. Lev, V. Luchangco, and N. Shavit. A provably correct scalable concurrent skip list. In Conference On Principles of Distributed Systems (OPODIS). Citeseer, 2006.
[12]
M. P. Herlihy and J. M. Wing. Linearizability: A correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst., 12(3):463– 492, July 1990. ISSN 0164-0925. URL http://doi.acm.org/ 10.1145/78969.78972.
[13]
M. Letia, N. M. Preguic¸a, and M. Shapiro. Crdts: Consistency without concurrency control. CoRR, abs/0907.0929, 2009. URL http:// arxiv.org/abs/0907.0929.
[14]
S. Marlow and S. P. Jones. Making a fast curry: Push/enter vs. eval/apply for higher-order languages. J. Funct. Program., 16(4-5): 415–449, July 2006. ISSN 0956-7968. URL http://dx.doi. org/10.1017/S0956796806005995.
[15]
S. Marlow and S. Peyton Jones. Multicore garbage collection with local heaps. In ACM SIGPLAN Notices, volume 46, pages 21–32. ACM, 2011.
[16]
S. Marlow, S. Peyton Jones, and S. Singh. Runtime support for multicore haskell. SIGPLAN Not., 44(9):65–78, Aug. 2009. ISSN 0362-1340.
[17]
. URL http://doi.acm.org/10.1145/1631687.
[18]
[19]
J. Nievergelt and E. M. Reingold. Binary search trees of bounded balance. SIAM journal on Computing, 2(1):33–43, 1973.
[20]
S. Peyton Jones, A. Gordon, and S. Finne. Concurrent haskell. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’96, pages 295–308, New York, NY, USA, 1996. ACM. ISBN 0-89791-769-3. URL http: //doi.acm.org/10.1145/237721.237794.
[21]
O. Shalev and N. Shavit. Split-ordered lists: Lock-free extensible hash tables. J. ACM, 53(3):379–405, May 2006. ISSN 0004-5411. URL http://doi.acm.org/10.1145/1147954.1147958.
[22]
N. Shavit. Data structures in the multicore age. Commun. ACM, 54: 76–84, Mar. 2011. ISSN 0001-0782. URL http://doi.acm.org/ 10.1145/1897852.1897873.
[23]
N. Shavit and D. Touitou. Elimination trees and the construction of pools and stacks: Preliminary version. In Proceedings of the Seventh Annual ACM Symposium on Parallel Algorithms and Architectures, SPAA ’95, pages 54–63, New York, NY, USA, 1995. ACM. ISBN 0-89791-717-0. URL http://doi.acm.org/10.1145/215399.
[24]
[25]
H. Sundell, A. Gidenstam, M. Papatriantafilou, and P. Tsigas. A lockfree algorithm for concurrent bags. In Proceedings of the 23rd ACM symposium on Parallelism in algorithms and architectures, SPAA ’11, pages 335–344, New York, NY, USA, 2011. ACM. ISBN 978-1- 4503-0743-7. URL http://doi.acm.org/10.1145/1989493.
[26]
[27]
G. Taubenfeld. Contention-sensitive data structures and algorithms. In Proceedings of the 23rd International Conference on Distributed Computing, DISC’09, pages 157–171, Berlin, Heidelberg, 2009. Springer-Verlag. ISBN 3-642-04354-2, 978-3-642-04354-3. URL http://dl.acm.org/citation.cfm?id=1813164.1813186.
[28]
G. Xu. Coco: Sound and adaptive replacement of java collections. In Proceedings of the 27th European Conference on Object-Oriented Programming, ECOOP’13, pages 1–26, Berlin, Heidelberg, 2013. Springer-Verlag. ISBN 978-3-642-39037-1. URL http://dx.doi. org/10.1007/978-3-642-39038-8_1.
[29]
Q. Zhao, D. Koh, S. Raza, D. Bruening, W.-F. Wong, and S. Amarasinghe. Dynamic cache contention detection in multi-threaded applications. In Proceedings of the 7th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments, VEE ’11, pages 27– 38, New York, NY, USA, 2011. ACM. ISBN 978-1-4503-0687-4. URL http://doi.acm.org/10.1145/1952682.1952688.

Index Terms

  1. Adaptive lock-free maps: purely-functional to scalable

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 9
    ICFP '15
    September 2015
    436 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858949
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
    • cover image ACM Conferences
      ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
      August 2015
      436 pages
      ISBN:9781450336697
      DOI:10.1145/2784731
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 29 August 2015
    Published in SIGPLAN Volume 50, Issue 9

    Check for updates

    Author Tags

    1. Concurrent data structures
    2. Lock-free algorithms

    Qualifiers

    • Research-article

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)8
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 13 Dec 2024

    Other Metrics

    Citations

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media