Exceptionally Safe Futures
A future is a well-known programming construct used to introduce concurrency to sequential programs. Computations annotated as futures are executed asynchronously and run concurrently with their continuations. Typically, futures are not transparent annotations: a program with futures need not produce the same result as the sequential program from which it was derived. Safe futures guarantee a future-annotated program produce the same result as its sequential counterpart. Ensuring safety is especially challenging in the presence of constructs such as exceptions that permit the expression of non-local control-flow. For example, a future may raise an exception whose handler is in its continuation. To ensure safety, we must guarantee the continuation does not discard this handler regardless of the continuation’s own internal control-flow (e.g. exceptions it raises or futures it spawns). In this paper, we present a formulation of safe futures for a higher-order functional language with first-class exceptions. Safety can be guaranteed dynamically by stalling the execution of a continuation that has an exception handler potentially required by its future until the future completes. To enable greater concurrency, we develop a static analysis and instrumentation and formalize the runtime behavior for instrumented programs that allows execution to discard handlers precisely when it is safe to do so.
Unable to display preview. Download preview PDF.
- 1.Flanagan, C., Felleisen, M.: The semantics of future and its use in program optimizations. In: Conference Record of POPL 1995, San Francisco, California, pp. 209–220 (1995)Google Scholar
- 4.Kranz, D., Halstead Jr., R.H., Mohr, E.: Mul-T: A high-performance parallel Lisp. In: PLDI 1989, vol. 24, pp. 81–90 (July 1989)Google Scholar
- 5.Mohr, R., Kranz, D., Halstead, R.: Lazy Task Creation: A Technique for Increasing the Granularity of Parallel Programs. In: ACM LFP Programming, June 1990, pp. 185–197 (1990)Google Scholar
- 6.Shivers, O.: Control-Flow Analysis of Higher-Order Languages or Taming Lambda. Ph.D thesis, Carnegie Mellon University (May 1991)Google Scholar
- 7.Palsberg, J.: Closure analysis in constraint form. In: ACM TOPLAS, pp. 47–62 (1995)Google Scholar
- 8.Navabi, A., Jagannathan, S.: Exceptionally Safe Futures. Tech. Report CSD TR #08-027, Purdue University Department of Computer Science, http://www.cs.purdue.edu/homes/anavabi/tr08027.pdf
- 9.Navabi, A., Zhang, X., Jagannathan, S.: Quasi-static scheduling for safe futures. In: PPOPP 2008, pp. 23–32 (2008)Google Scholar
- 10.Welc, A., Jagannathan, S., Hosking, A.: Safe futures for java. In: OOPSLA 2005, pp. 439–453. ACM Press, New York (2005)Google Scholar
- 11.Zhang, L., Krintz, C., Nagpurkar, P.: Supporting Exception Handling for Futures in Java. In: PPPJ, pp. 175–184 (2007)Google Scholar
- 13.Allan, E., Chase, D., Luchangco, V., Maessen, J., Ryu, S., Steele, G., Tobin-Hochstadt, S.: The Fortress Language Specification Version 1.0. Tech. report, Sun Microsystems (2008)Google Scholar
- 14.Charles, P., Grothoff, C., Saraswat, V., Donawa, C., Kielstra, A., Ebcioglu, K., von Praun, C., Sarkar, V.: X10: an object-oriented approach to non-uniform cluster computing. In: OOPSLA 2005, pp. 519–538 (2005)Google Scholar