skip to main content
research-article

Adaptive lock-free maps: purely-functional to scalable

Published:29 August 2015Publication History
Skip Abstract Section

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.Google ScholarGoogle Scholar
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. K. Fraser. Practical lock-freedom. PhD thesis, University of Cambridge, 2004.Google ScholarGoogle Scholar
  7. A. Gill and G. Hutton. The worker/wrapper transformation. J. Funct. Program., 19(2):227–251, Mar. 2009. ISSN 0956-7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. . URL http://dx.doi.org/10.1017/S0956796809007175.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. Marlow and S. Peyton Jones. Multicore garbage collection with local heaps. In ACM SIGPLAN Notices, volume 46, pages 21–32. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. . URL http://doi.acm.org/10.1145/1631687.Google ScholarGoogle Scholar
  18. 1596563.Google ScholarGoogle Scholar
  19. J. Nievergelt and E. M. Reingold. Binary search trees of bounded balance. SIAM journal on Computing, 2(1):33–43, 1973.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 215419.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 1989550.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

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

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • 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

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 29 August 2015

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!