skip to main content
research-article

Partial memoization of concurrency and communication

Published:31 August 2009Publication History
Skip Abstract Section

Abstract

Memoization is a well-known optimization technique used to eliminate redundant calls for pure functions. If a call to a function f with argument v yields result r, a subsequent call to f with v can be immediately reduced to r without the need to re-evaluate f's body. Understanding memoization in the presence of concurrency and communication is significantly more challenging. For example, if f communicates with other threads, it is not sufficient to simply record its input/output behavior; we must also track inter-thread dependencies induced by these communication actions. Subsequent calls to f can be elided only if we can identify an interleaving of actions from these call-sites that lead to states in which these dependencies are satisfied. Similar issues arise if f spawns additional threads. In this paper, we consider the memoization problem for a higher-order concurrent language whose threads may communicate through synchronous message-based communication. To avoid the need to perform unbounded state space search that may be necessary to determine if all communication dependencies manifest in an earlier call can be satisfied in a later one, we introduce a weaker notion of memoization called partial memoization that gives implementations the freedom to avoid performing some part, if not all, of a previously memoized call. To validate the effectiveness of our ideas, we consider the benefits of memoization for reducing the overhead of recomputation for streaming, server-based, and transactional applications executed on a multi-core machine. We show that on a variety of workloads, memoization can lead to substantial performance improvements without incurring high memory costs.

Skip Supplemental Material Section

Supplemental Material

partialmemoizationofconcurrencyandcommunicationonvimeo.mp4

References

  1. Umut A. Acar, Guy E. Blelloch, and Robert Harper. Selective Memoization. In POPL, pages 14--25, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Umut A. Acar, Amal Ahmed, and Matthias Blume. Imperative Self-Adjusting Computation. In POPL, pages 309--322, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ali-Reza Adl-Tabatabai, Brian T. Lewis, Vijay Menon, Brian R. Murphy, Bratin Saha, and Tatiana Shpeisman. Compiler and Runtime Support for Efficient Software Transactional Memory. In PLDI, pages 26--37, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Michael J. Carey, David J. DeWitt, and Jeffrey F. Naughton. The 007 benchmark. SIGMOD Record, 22 (2): 12--21, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Kevin Donnelly and Matthew Fluet. Transactional Events. In ICFP, pages 124--135, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Laura Effinger-Dean, Matthew Kehrt, and Dan Grossman. Transactional events for ml. In ICFP '08, pages 103--114, 2008. ISBN 978-1-59593-919-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Michael I. Gordon, William Thies, and Saman Amarasinghe. Exploiting Coarse-Grained Task, Data, and Pipeline Parallelism in Stream Programs. In ASPLOS-XII, pages 151--162, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Rachid Guerraoui, Michal Kapalka, and Jan Vitek. STMBench7: A Benchmark for Software Transactional Memory. In EuroSys, pages 315--324, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Matthew Hammer, Umut A. Acar, Mohan Rajagopalan, and Anwar Ghuloum. A Proposal for Parallel Self-Adjusting Computation. In Workshop on Declarative Aspects of Multicore Programming, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Tim Harris and Keir Fraser. Language support for lightweight transactions. In OOPSLA, pages 388--402, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Tim Harris, Simon Marlow, Simon Peyton-Jones, and Maurice Herlihy. Composable Memory Transactions. In Proceedings of the ACM Conference on Principles and Practice of Parallel Programming, pages 48--60, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Allan Heydon, Roy Levin, and Yuan Yu. Caching function calls using precise dependencies. In PLDI, pages 311--320, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ruy Ley-Wild, Matthew Fluet, and Umut A. Acar. Compiling self-adjusting programs with continuations. In ICFP, pages 321--334, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Yanhong A. Liu and Tim Teitelbaum. Caching Intermediate Results for Program Improvement. In PEPM, pages 190--201, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Richard Matthew Mccutchen and Samir Khuller. Streaming algorithms for k-center clustering with outliers and with anonymity. In APPROX '08 / RANDOM '08, pages 165--178, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. MLton. http://www.mlton.org.Google ScholarGoogle Scholar
  17. Christopher J. F. Pickett and Clark Verbrugge. Software Thread Level Speculation for the Java Language and Virtual Machine Environment. In Proceedings of the International Workshop on Languages and Compilers for Parallel Computing, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. W. Pugh and T. Teitelbaum. Incremental Computation via Function Caching. In POPL, pages 315--328, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. William Pugh. An Improved Replacement Strategy for Function Caching. In LFP, pages 269--276, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Shaz Qadeer, Sriram K. Rajamani, and Jakob Rehof. Summarizing procedures in concurrent programs. In POPL, pages 245--255, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. John Reppy and Yingqi Xiao. Towards a Parallel Implementation of Concurrent ML. In DAMP 2008, January 2008.Google ScholarGoogle Scholar
  22. John H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Michael F. Ringenburg and Dan Grossman. AtomCaml: First-Class Atomicity via Rollback. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pages 92--104, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Bratin Saha, Ali-Reza Adl-Tabatabai, Richard L. Hudson, Chi Cao Minh, and Benjamin Hertzberg. McRT-STM: a High-Performance Software Transactional Memory system for a Multi-Core Runtime. In PPoPP, pages 187--197, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Kedar Swadi, Walid Taha, Oleg Kiselyov, and Emir Pasalic. A Monadic Approach for Avoiding Code Duplication When Staging Memoized Functions. In PEPM, pages 160--169, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Lukasz Ziarek, Philip Schatz, and Suresh Jagannathan. Stabilizers: A Modular Checkpointing Abstraction for Concurrent Functional Programs. In ACM International Conference on Functional Programming, pages 136--147, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Partial memoization of concurrency and communication

            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

            Full Access

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!