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. 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
  2. 2.
    Courtois, P.J., Heymans, F., Parnas, D.L.: Concurrent control with “readers” and “writers”. Commun. ACM 14(10)667–668 (1971).CrossRefGoogle Scholar
  3. 3.
    Fisher, R., Yates, F.: Statistical Tables for Biological, Agricultural and Medical Research. Oliver and Boyd, London, 3rd edn. (1948).MATHGoogle Scholar
  4. 4.
    Hewitt, C., Bishop, P., Steiger, R.: A universal modular actor formalism for artificial intelligence. International Joint Conference on Artificial Intelligence (1973).Google Scholar
  5. 5.
    Hoare, C.A.R.: Partition: Algorithm 63, quicksort: Algorithm 64, and find: Algorithm 65. Commun. the ACM 4(7)321–322 (1961).CrossRefGoogle Scholar
  6. 6.
    Hoare, C.A.R.: Communicating sequential processes. Commun. ACM 21(8)666–677 (1978).CrossRefMATHMathSciNetGoogle Scholar
  7. 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. 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. 9.
    Kitchin, D., Quark, A., Cook, W.R., Misra, J.: Orc user guide. http://orc.csres.utexas.edu/userguide/html/index.html.
  10. 0.
    Knuth, D.E.: Seminumerical Algorithms, vol. 2 of The Art of Computer Programming, 3rd edn. Addison-Wesley, Reading, (1997).Google Scholar
  11. 1.
    Knuth, D.E.: Sorting and Searching, vol. 2 of The Art of Computer Programming, 2nd edn. Addison-Wesley, Reading, MA (1998).Google Scholar
  12. 2.
    Milner, R.: A Calculus of Communicating Systems. Springer LNCS Vol. 12, Springer-Verlag (1980).CrossRefMATHGoogle Scholar
  13. 3.
    Milner, R.: Communicating and Mobile Systems: the π-Calculus. Cambridge University Press, Cambridge (May 1999).Google Scholar
  14. 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
  15. 5.
    Paulson, L.C.: ML for the Working Programmer. Cambridge University Press, Cambridge (1991).Google Scholar
  16. 6.
    Quark, A., Kitchin, D., Cook, W.R., Misra, J.: Orc language project website. http://orc.csres.utexas.edu.
  17. 7.
    Sedgewick, R.: Quicksort. PhD thesis, Stanford University (1975).Google Scholar
  18. 8.
    Wehrman, I., Kitchin, D., Cook, W., Misra, J.: A timed semantics of Orc. Theoret. Comput. Sci. 402(2–3)234–248 (August 2008).MATHMathSciNetGoogle Scholar
  19. 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

Copyright information

© Springer London 2010

Authors and Affiliations

  1. 1.University of Texas at AustinAustinUSA

Personalised recommendations