Skip to main content

Thread-Safe Priority Queues in Haskell Based on Skiplists

  • Conference paper
Trends in Functional Programming (TFP 2011)

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

Included in the following conference series:

  • 474 Accesses

Abstract

Although thread-safe priority queues are fundamental building blocks for many parallel algorithms, there are currently no scalable implementations available in Haskell. An efficient structure to implement priority queues is the skiplist, which is a multi-level linked list with shortcuts. We developed three thread-safe skiplist variants, based on locks, software transactional memory, and atomic compare-and-swap, respectively. In our benchmarks, the lock-based and compare-and-swap variants scaled about equally well, while the transactional variant was by several orders of magnitude slower.

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 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 72.00
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. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. MIT Press (2001)

    Google Scholar 

  2. Pugh, W.: Skip lists: a probabilistic alternative to balanced trees. Commun. ACM 33, 668–676 (1990)

    Article  Google Scholar 

  3. Fomitchev, M., Ruppert, E.: Lock-free linked lists and skip lists. In: Proceedings of the Twenty-Third Annual ACM Symposium on Principles of Distributed Computing, PODC 2004, pp. 50–59. ACM, New York (2004)

    Chapter  Google Scholar 

  4. Lotan, I., Shavit., N.: Skiplist-based concurrent priority queues. In: Proc. of the 14th International Parallel and Distributed Processing Symposium (IPDPS), pp. 263–268 (2000)

    Google Scholar 

  5. Sundell, H., Tsigas, P.: Fast and lock-free concurrent priority queues for multi-thread systems. J. Parallel Distrib. Comput. 65, 609–627 (2005)

    Article  MATH  Google Scholar 

  6. Pugh, W.: Concurrent maintenance of skip lists. Technical report, College Park, MD, USA (1990)

    Google Scholar 

  7. Hunt, G.C., Michael, M.M., Parthasarathy, S., Scott, M.L.: An efficient algorithm for concurrent priority queue heaps. Inf. Process. Lett. 60, 151–157 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  8. Kumar, V., Grama, A., Gupta, A., Karypis, G.: Introduction to parallel computing: design and analysis of algorithms. Benjamin-Cummings Publishing Co., Inc., Redwood City (1994)

    MATH  Google Scholar 

  9. GitHub: repository with source code (available May 2011), http://github.com/mlesniak/haskell-priorityqueue

  10. Jones, M.P.: Type Classes with Functional Dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  11. Jones, S.P., Gordon, A., Finne, S.: Concurrent haskell, pp. 295–308. ACM Press (1996)

    Google Scholar 

  12. Shavit, N., Touitou, D.: Software transactional memory. In: Proceedings of the Fourteenth Annual ACM Symposium on Principles of Distributed Computing, PODC 1995, pp. 204–213. ACM, New York (1995)

    Chapter  Google Scholar 

  13. Harris, T., Marlow, S., Peyton-Jones, S., Herlihy, M.: Composable memory transactions. In: PPoPP 2005: Proceedings of the Tenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 48–60. ACM, New York (2005)

    Chapter  Google Scholar 

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

  15. Sulzmann, M., Lam, E.S., Marlow, S.: Comparing the performance of concurrent linked-list implementations in haskell (abstract only). SIGPLAN Not. 44, 9 (2009)

    Article  Google Scholar 

  16. Valois, J.D.: Lock-free linked lists using compare-and-swap. In: Proceedings of the Fourteenth Annual ACM Symposium on Principles of Distributed Computing, PODC 1995, pp. 214–222. ACM, New York (1995)

    Chapter  Google Scholar 

  17. Stolz, V., Huch, F.: Runtime verification of concurrent haskell programs. In: Proceedings of the Fourth Workshop on Runtime Verification, pp. 201–216. Elsevier Science Publishers (2004)

    Google Scholar 

  18. Papaefthymiou, M., Rodrigue, J.: Implementing parallel shortest-paths algorithms. In: Bhatt, S.N. (ed.) Parallel Algorithms. DIMACS Series in Discrete Mathematics and Theoretical Computer Science, vol. 30, pp. 59–68. American Mathematical Society (1997)

    Google Scholar 

  19. Subramanian, S.: Parallel and dynamic shortest-path algorithms for sparse graphs. Technical report, Providence, RI, USA (1995)

    Google Scholar 

  20. Claessen, K., Hughes, J.: Quickcheck: A lightweight tool for random testing of haskell programs. In: ICFP, pp. 268–279. ACM Press, New York (2000)

    Chapter  Google Scholar 

  21. Jones, D., Marlow, S., Singh, S.: Parallel performance tuning for haskell. In: Haskell 2009: Proceedings of the Second ACM SIGPLAN Symposium on Haskell. ACM (2009)

    Google Scholar 

  22. Dragicevic, K., Bauer, D.: A survey of concurrent priority queue algorithms. In: IPDPS, pp. 1–6. IEEE (2008)

    Google Scholar 

  23. Okasaki, C.: Purely functional data structures. Cambridge University Press, Cambridge (1998)

    Book  Google Scholar 

  24. O’Sullivan, B., Tibell, J.: Scalable i/o event handling for ghc. In: Proceedings of the Third ACM Haskell Symposium on Haskell 2010, pp. 103–108. ACM, New York (2010)

    Chapter  Google Scholar 

  25. Newton, R., Chen, C.P., Marlow, S.: Intel concurrent collections for haskell. Submitted to the Haskell Symposium 2010 (2010)

    Google Scholar 

  26. Chakravarty, M.M.T., Leshchinskiy, R., Jones, S.P., Keller, G., Marlow, S.: Data parallel haskell: a status report. In: Proceedings of the 2007 Workshop on Declarative Aspects of Multicore Programming, DAMP 2007, pp. 10–18. ACM, New York (2007)

    Chapter  Google Scholar 

  27. Marlow, S., Peyton Jones, S., Singh, S.: Runtime support for multicore haskell. SIGPLAN Not. 44(9), 65–78 (2009)

    Article  Google Scholar 

  28. Wicke, G.: The bits-atomic package on hackage, http://hackage.haskell.org/package/bits-atomic

  29. Intel Manycore Testing Lab, http://software.intel.com/en-us/articles/intel-many-core-testing-lab/

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Lesniak, M. (2012). Thread-Safe Priority Queues in Haskell Based on Skiplists. In: Peña, R., Page, R. (eds) Trends in Functional Programming. TFP 2011. Lecture Notes in Computer Science, vol 7193. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-32037-8_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-32037-8_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-32036-1

  • Online ISBN: 978-3-642-32037-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics