Quicksort: Combining Concurrency, Recursion, and Mutable Data Structures
Quicksort (Commun. ACM 4(7):321–322, 1961) remains one of the most studied algorithms in computer science. It is important not only as a practical sorting method, but also as a splendid teaching aid for introducing recursion and systematic algorithm development. The algorithm has been studied extensively; so, it is natural to assume that everything that needs to be said about it has already been said. Yet, in attempting to code it using a recent programming language of our design, we discovered that its structure is more clearly expressed as a concurrent program that manipulates a shared mutable store, without any locking or explicit synchronization. In this paper, we describe the essential aspects of our programming language Orc (Proceedings of FMOODS/FORTE, vol. 5522 of LNCS, pp. 1–25. Springer 2009), show a number of examples that combine its features in various forms, and then develop a concise description of Quicksort. We hope to highlight the importance of including concurrency, recursion and mutability within a single theory.
- 1.Armstrong, J., Virding, R., Wikström, C., Williams, M.: Concurrent Programming in ERLANG 2nd edn. Prentice Hall International (UK) Ltd., Hertfordshire, UK, (1996).Google Scholar
- 4.Hewitt, C., Bishop, P., Steiger, R.: A universal modular actor formalism for artificial intelligence. International Joint Conference on Artificial Intelligence (1973).Google Scholar
- 7.Kitchin, D., Cook, W.R., Misra, J.: A language for task orchestration and its semantic properties. In: CONCUR, pp. 477–491 (2006).Google Scholar
- 8.Kitchin, D., Quark, A., Cook, W., Misra, J.: The Orc programming language. In Lee, D., Lopes, A., Poetzsch-Heffter, A: (eds.) Formal Techniques for Distributed Systems; Proceedings of FMOODS/FORTE, vol. 5522 of LNCS, pp. 1–25. Springer, Lisbon (2009).Google Scholar
- 9.Kitchin, D., Quark, A., Cook, W.R., Misra, J.: Orc user guide. http://orc.csres.utexas.edu/userguide/html/index.html.
- 0.Knuth, D.E.: Seminumerical Algorithms, vol. 2 of The Art of Computer Programming, 3rd edn. Addison-Wesley, Reading, (1997).Google Scholar
- 1.Knuth, D.E.: Sorting and Searching, vol. 2 of The Art of Computer Programming, 2nd edn. Addison-Wesley, Reading, MA (1998).Google Scholar
- 3.Milner, R.: Communicating and Mobile Systems: the π-Calculus. Cambridge University Press, Cambridge (May 1999).Google Scholar
- 4.Misra, J.: Computation orchestration: A basis for wide-area computing. In Broy, M: (ed.) Proc. of the NATO Advanced Study Institute, Engineering Theories of Software Intensive Systems, NATO ASI Series, Marktoberdorf, Germany, (2004).Google Scholar
- 5.Paulson, L.C.: ML for the Working Programmer. Cambridge University Press, Cambridge (1991).Google Scholar
- 6.Quark, A., Kitchin, D., Cook, W.R., Misra, J.: Orc language project website. http://orc.csres.utexas.edu.
- 7.Sedgewick, R.: Quicksort. PhD thesis, Stanford University (1975).Google Scholar
- 9.Wehrman, I., Kitchin, D., Cook, W.R., Misra, J.: Properties of the timed operational and denotational semantics of Orc. Technical Report TR-07-65, The University of Texas at Austin, Department of Computer Sciences (December 2007).Google Scholar