skip to main content
10.1145/2774975.2774976acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

SnapQueue: lock-free queue with constant time snapshots

Published:13 June 2015Publication History

ABSTRACT

We introduce SnapQueues - concurrent, lock-free queues with a linearizable, lock-free global-state transition operation. This transition operation can atomically switch between arbitrary SnapQueue states, and is used by enqueue, dequeue, snapshot and concatenation operations. We show that implementing these operations efficiently depends on the persistent data structure at the core of the SnapQueue. This immutable support data structure is an interchangeable kernel of the SnapQueue, and drives its performance characteristics. The design allows reasoning about concurrent operation running time in a functional way, absent from concurrency considerations. We present a support data structure that enables O(1) queue operations, O(1) snapshot and O(log n) atomic concurrent concatenation. We show that the SnapQueue enqueue operation achieves up to 25% higher performance, while the dequeue operation has performance identical to standard lock-free concurrent queues.

References

  1. Akka documentation, 2015. http://akka.io/docs/.Google ScholarGoogle Scholar
  2. SnapQueue Implementation, 2015. https://github.com/stormenroute/reactive-collections/tree/master/reactive-collectionscore.Google ScholarGoogle Scholar
  3. G. M. Adelson-Velsky and E. M. Landis. An algorithm for the organization of information. Doklady Akademii Nauk SSSR, 146:263–266, 1962.Google ScholarGoogle Scholar
  4. Y. Afek, N. Shavit, and M. Tzafrir. Interrupting snapshots and the JavaTM size method. J. Parallel Distrib. Comput., 72(7):880–888, July 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. E. Allen, D. Chase, J. Hallett, V. Luchangco, J.-W. Maessen, S. Ryu, G. Steele, and S. Tobin-Hochstadt. The Fortress Language Specification. Technical report, Sun Microsystems, Inc., 2007.Google ScholarGoogle Scholar
  6. N. G. Bronson, J. Casper, H. Chafi, and K. Olukotun. A practical concurrent binary search tree. SIGPLAN Not., 45(5):257– 268, Jan. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Click. Towards a scalable non-blocking coding style, 2007.Google ScholarGoogle Scholar
  8. A. Georges, D. Buytaert, and L. Eeckhout. Statistically rigorous java performance evaluation. SIGPLAN Not., 42(10):57– 76, Oct. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Haller, A. Prokopec, H. Miller, V. Klang, R. Kuhn, and V. Jovanovic. Scala Improvement Proposal: Futures and Promises (SIP-14). 2012.Google ScholarGoogle Scholar
  10. M. Herlihy and N. Shavit. The Art of Multiprocessor Programming. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Hinze and R. Paterson. Finger trees: A simple generalpurpose data structure. J. Funct. Program., 16(2):197–217, Mar. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. H. Kaplan and R. E. Tarjan. Purely functional representations of catenable sorted lists. In Proceedings of the Twenty-Eighth Annual ACM Symposium on the Theory of Computing, Philadelphia, Pennsylvania, USA, May 22-24, 1996, pages 202–211, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Lea. Doug Lea’s workstation, 2014.Google ScholarGoogle Scholar
  14. M. M. Michael and M. L. Scott. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In PODC, pages 267–275, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Moir and N. Shavit. Concurrent data structures. In Handbook of Data Structures and Applications, D. Metha and S. Sahni Editors, pages 47–14 — 47–30, 2007. Chapman and Hall/CRC Press.Google ScholarGoogle Scholar
  16. C. Okasaki. Purely Functional Data Structures. Cambridge University Press, New York, NY, USA, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Prokopec. Data Structures and Algorithms for Data-Parallel Computing in a Managed Runtime. PhD thesis, IC, EPFL, Lausanne, 2014.Google ScholarGoogle Scholar
  18. A. Prokopec. ScalaMeter Benchmarking Suite Website, 2014. http://scalameter.github.io.Google ScholarGoogle Scholar
  19. A. Prokopec, N. G. Bronson, P. Bagwell, and M. Odersky. Concurrent tries with efficient non-blocking snapshots. pages 151–160, 2012.Google ScholarGoogle Scholar
  20. A. Prokopec, H. Miller, T. Schlatter, P. Haller, and M. Odersky. FlowPools: A lock-free deterministic concurrent dataflow abstraction. In LCPC, pages 158–173, 2012.Google ScholarGoogle Scholar
  21. W. Pugh. Concurrent maintenance of skip lists. Technical report, College Park, MD, USA, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. W. N. Scherer, D. Lea, and M. L. Scott. Scalable synchronous queues. Commun. ACM, 52(5):100–111, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. T. Schlatter, A. Prokopec, H. Miller, P. Haller, and M. Odersky. Multi-lane flowpools: A detailed look. Technical report, EPFL, Lausanne, September 2012.Google ScholarGoogle Scholar
  24. R. Soulé, M. I. Gordon, S. Amarasinghe, R. Grimm, and M. Hirzel. Dynamic expressivity with static optimization for streaming languages. In Proceedings of the 7th ACM International Conference on Distributed Event-based Systems, DEBS ’13, pages 159–170, New York, NY, USA, 2013. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. G. Steele. Organizing functional code for parallel execution; or, foldl and foldr considered slightly harmful. International Conference on Functional Programming (ICFP), 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. S. Tasharofi. Efficient testing of actor programs with nondeterministic behaviors. PhD thesis, University of Illinois at Urbana-Champaign, 2014.Google ScholarGoogle Scholar
  27. M. Thompson, D. Farley, M. Barker, P. Gee, and A. Stewart. Disruptor: High performance alternative to bounded queues for exchanging data between concurrent threads. May 2011.Google ScholarGoogle Scholar

Index Terms

  1. SnapQueue: lock-free queue with constant time snapshots

            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
            • Published in

              cover image ACM Conferences
              SCALA 2015: Proceedings of the 6th ACM SIGPLAN Symposium on Scala
              June 2015
              55 pages
              ISBN:9781450336260
              DOI:10.1145/2774975

              Copyright © 2015 ACM

              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 ACM 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: 13 June 2015

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article

              Acceptance Rates

              Overall Acceptance Rate5of6submissions,83%

              Upcoming Conference

              PLDI '24

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader