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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. MIT Press (2001)
Pugh, W.: Skip lists: a probabilistic alternative to balanced trees. Commun. ACM 33, 668–676 (1990)
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)
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)
Sundell, H., Tsigas, P.: Fast and lock-free concurrent priority queues for multi-thread systems. J. Parallel Distrib. Comput. 65, 609–627 (2005)
Pugh, W.: Concurrent maintenance of skip lists. Technical report, College Park, MD, USA (1990)
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)
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)
GitHub: repository with source code (available May 2011), http://github.com/mlesniak/haskell-priorityqueue
Jones, M.P.: Type Classes with Functional Dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)
Jones, S.P., Gordon, A., Finne, S.: Concurrent haskell, pp. 295–308. ACM Press (1996)
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)
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)
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)
Sulzmann, M., Lam, E.S., Marlow, S.: Comparing the performance of concurrent linked-list implementations in haskell (abstract only). SIGPLAN Not. 44, 9 (2009)
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)
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)
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)
Subramanian, S.: Parallel and dynamic shortest-path algorithms for sparse graphs. Technical report, Providence, RI, USA (1995)
Claessen, K., Hughes, J.: Quickcheck: A lightweight tool for random testing of haskell programs. In: ICFP, pp. 268–279. ACM Press, New York (2000)
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)
Dragicevic, K., Bauer, D.: A survey of concurrent priority queue algorithms. In: IPDPS, pp. 1–6. IEEE (2008)
Okasaki, C.: Purely functional data structures. Cambridge University Press, Cambridge (1998)
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)
Newton, R., Chen, C.P., Marlow, S.: Intel concurrent collections for haskell. Submitted to the Haskell Symposium 2010 (2010)
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)
Marlow, S., Peyton Jones, S., Singh, S.: Runtime support for multicore haskell. SIGPLAN Not. 44(9), 65–78 (2009)
Wicke, G.: The bits-atomic package on hackage, http://hackage.haskell.org/package/bits-atomic
Intel Manycore Testing Lab, http://software.intel.com/en-us/articles/intel-many-core-testing-lab/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)