ABSTRACT
Molecule is a domain specific language library embedded in Scala for easing the creation of scalable and modular concurrent applications on the JVM. Concurrent applications are modeled as parallel process networks that exchange information over mobile and type-safe messaging interfaces. In this paper, we present a concurrent programming environment that combines functional and imperative programming. Using a monad, we structure the sequential or parallel coordination of user-level threads, without JVM modifications or compiler support. Our mobile channel interfaces expose reusable and parallelizable higher-order functions, as if they were streams in a lazily evaluated functional programming language. The support for graceful termination of entire process networks is simplified by integrating channel poisoning with monadic exceptions and resource control. Our runtime and system-level interfaces leverage message batching and a novel flow parallel scheduler to limit expensive context switches in multicore environments. We illustrate the expressiveness and performance benefits on a 24-core AMD Opteron machine with three classical examples: a thread ring, a genuine prime sieve and a chameneos-redux.
- Agha, G. Actors: a model of concurrent computation in distributed systems. MIT Press, 1986. Google ScholarDigital Library
- Anderson, T., Bershad, B., Lazowska, E., and Levy, H. Scheduler activations: effective kernel support for the user-level management of parallelism. ACM Trans. Comput. Syst. 10 (Feb. 1992), 53--79. Google ScholarDigital Library
- Backus, J. Can programming be liberated from the von Neumann style?: a functional style and its algebra of programs. Commun. ACM 21, 8 (Aug. 1978), 613--641. Google ScholarDigital Library
- Banker, R., Davis, G., and Slaughter, S. Software development practices, software complexity, and software maintenance performance: a field study. Manage. Sci. 44 (Apr. 1998), 433--450. Google ScholarDigital Library
- Brown, N. C. C. Communicating Haskell Processes: Composable Explicit Concurrency using Monads. In Communicating Processes Architecture 2008 (Sept. 2008), pp. 67--83.Google Scholar
- Clinger, W., Hartheimer, A., and Ost, E. Implementation strategies for continuations. In Proceedings of the 1988 ACM conference on LISP and functional programming (July 1988), pp. 124--131. Google ScholarDigital Library
- Coutts, D., Leshchinskiy, R., and Stewart, D. Stream fusion: from lists to streams to nothing at all. SIGPLAN Not. 42 (Oct. 2007), 315--326. Google ScholarDigital Library
- Danvy, O., and Filinski, A. Representing Control: A Study of the CPS Transformation. Mathematical Structures in Computer Science 2, 4 (1992), 361--391.Google ScholarCross Ref
- Ganz, S., Friedman, D., and Wand, M. Trampolined style. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (1999), pp. 18--27. Google ScholarDigital Library
- Gelernter, D., and Carriero, N. Coordination languages and their significance. Commun. ACM 35 (Feb. 1992), 97--107. Google ScholarDigital Library
- Halen, J., Karlsson, R., and Nilsson, M. Performance measurements of threads in Java and processes in Erlang. Available at http://www.sics.se/joe/ericsson/du98024.html, Last visit April 2012.Google Scholar
- Haller, P., and Odersky, M. Scala actors: Unifying thread-based and event-based programming. Theoretical Computer Science (2008). Google ScholarDigital Library
- Haller, P., and Odersky, M. Capabilities for Uniqueness and Borrowing. In Proceedings of the 24th European Conference on Object-Oriented Programming (2010). Google ScholarDigital Library
- Hewitt, C., Bishop, P., and Steiger, R. A universal modular ACTOR formalism for artificial intelligence. In Proceedings of the 3rd international joint conference on Artificial intelligence (1973), pp. 235--245. Google ScholarDigital Library
- Hilderink, G. Managing Complexity of Control Software through Concurrency. PhD thesis, University of Twente, May 2005.Google Scholar
- Hoare, C. A. R. Communicating sequential processes. Commun. ACM 21 (Aug. 1978), 666--677. Google ScholarDigital Library
- Hudak, P. Modular domain specific languages and tools. In Proceedings of the 5th International Conference on Software Reuse (1998), pp. 134--. Google ScholarDigital Library
- Jones, M., and Hudak, P. Implicit and Explicit Parallel Programming in Haskell. Tech. Rep. YALEU/DCS/RR-982, Department of Computer Science, Yale University, Aug 1993.Google Scholar
- Kahn, G. The Semantics of a Simple Language for Parallel Programming. In Information Processing '74: Proceedings of the IFIP Congress. North-Holland, Aug. 1974, pp. 471--475.Google Scholar
- Kahn, G., and Macqueen, D. Coroutines and Networks of Parallel Processes. In Information Processing '77: Proceedings of the IFIP Congress. North-Holland, 1977, pp. 993--998.Google Scholar
- Kaiser, C., and Pradat-Peyre, J. Chameneos, a concurrency game for Java, Ada and others. Int. Conf. ACS/IEEE AICCSA (2003).Google ScholarCross Ref
- Karmani, R. K., Shali, A., and Agha, G. Actor frameworks for the JVM platform: a comparative analysis. In Proceedings of the 7th International Conference on Principles and Practice of Programming in Java (2009), pp. 11--20. Google ScholarDigital Library
- Lea, D. A Java fork/join framework. In Proceedings of the ACM 2000 conference on Java Grande (2000), pp. 36--43. Google ScholarDigital Library
- Li, P., and Zdancewic, S. Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. In PLDI '07: Proceedings of the 2007 ACM SIGPLAN conference on Programming language design and implementation (2007), pp. 189--199. Google ScholarDigital Library
- Manson, J., Pugh, W., and Adve, S. V. The Java memory model. SIGPLAN Not. 40 (Jan. 2005), 378--391. Google ScholarDigital Library
- Milner, R. Communicating and Mobile Systems: the Pi-Calculus. Cambridge University Press, June 1999. Google ScholarDigital Library
- Odersky, M., Spoon, L., and Venners, B. Programming in Scala, Second Edition. Artima, 2011.Google Scholar
- Oliveira, B. C., Moors, A., and Odersky, M. Type classes as objects and implicits. In Proceedings of the ACM international conference on Object oriented programming systems languages and applications (2010), pp. 341--360. Google ScholarDigital Library
- Peyton Jones, S., Gordon, A., and Finne, S. Concurrent Haskell. In 23rd ACM Symposium on Principles of Programming Languages (1996), pp. 295--308. Google ScholarDigital Library
- Peyton Jones, S., and Hughes, J. Report on the programming language Haskell 98, a non-strict, purely functional language. Tech. rep., Haskell comittee, 1999.Google Scholar
- Peyton Jones, S., and Wadler, P. Imperative functional programming. In Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages (1993), pp. 71--84. Google ScholarDigital Library
- Ritson, C., Sampson, A., and Barnes, F. Multicore scheduling for lightweight communicating processes. In Proceedings of the 11th international conference on Coordination Models and Languages (2009), pp. 163--183. Google ScholarDigital Library
- Rompf, T., Maier, I., and Odersky, M. Implementing First-Class Polymorphic Delimited Continuations by a Type-Directed Selective CPS-Transform. In Proceedings of the 14th ACM SIGPLAN international conference on Functional programming (2009). Google ScholarDigital Library
- Rytz, L., Odersky, M., and Haller, P. Lightweight Polymorphic Effects. In Proceedings of the 26th European Conference on Object-Oriented Programming (2012). Google ScholarDigital Library
- Saltzer, J. H., Reed, D. P., and Clark, D. D. End-to-end arguments in system design. ACM Trans. Comput. Syst. 2 (Nov. 1984), 277--288. Google ScholarDigital Library
- Sampson, A. Process-Oriented Patterns for Concurrent Software Engineering. PhD thesis, University of Kent, Oct. 2010.Google Scholar
- Sputh, B. H. C., and Allen, A. R. JCSP-Poison: Safe termination of CSP process networks. In Proceedings of the 28th conference on Communicating Process Architectures (2005), pp. 71--107.Google Scholar
- Srinivasan, S. Kilim: A server framework with lightweight actors, isolation types and zero-copy messaging. Tech. Rep. UCAM-CL-TR-769, University of Cambridge, Computer Laboratory, Feb. 2010.Google Scholar
- Syme, D., Petricek, T., and Lomov, D. The F# Asynchronous Programming Model. In Proceedings of the 13th International Symposium on Practical Aspects of Declarative Languages (2011), pp. 175--189. Google ScholarDigital Library
- Torgersen, M. Asynchronous Programming in C# and Visual Basic. White paper, Microsoft, Oct. 2010. Available online.Google Scholar
- and Williams}Armstrong:1996:CPE:229883 Virding, R., Wikström, C., and Williams, M. Concurrent programming in ERLANG (2nd ed.). Prentice Hall International (UK) Ltd., 1996. Google ScholarDigital Library
- von Behren, J. R., Condit, J., and Brewer, E. A. Why Events Are a Bad Idea (for High-Concurrency Servers). In Proceedings of the 2003 HotOS Workshop (May 2003), pp. 19--24. Google ScholarDigital Library
- Wadler, P. Deforestation: transforming programs to eliminate trees. Theor. Comput. Sci. 73 (Jan. 1988), 231--248. Google ScholarDigital Library
- Wadler, P. Monads for functional programming. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques-Tutorial Text (1995), pp. 24--52. Google ScholarDigital Library
- Wadler, P. An angry half-dozen. SIGPLAN Not. 33 (Feb. 1998), 25--30. Google ScholarDigital Library
- Welch, P., and Barnes, F. Communicating mobile processes: introducing occam-pi. In 25 Years of CSP (Apr. 2005), pp. 175--210. Google ScholarDigital Library
- Welch, P. H. Graceful Termination -- Graceful Resetting. In Applying Transputer-Based Parallel Machines, Proceedings of OUG 10 (Apr. 1989), pp. 310--317.Google Scholar
Index Terms
- Molecule: using monadic and streaming I/O to compose process networks on the JVM
Recommendations
Molecule: using monadic and streaming I/O to compose process networks on the JVM
OOPSLA '12Molecule is a domain specific language library embedded in Scala for easing the creation of scalable and modular concurrent applications on the JVM. Concurrent applications are modeled as parallel process networks that exchange information over mobile ...
A Domain-Specific Embedded Language for Programming Parallel Architectures
DCABES '13: Proceedings of the 2013 12th International Symposium on Distributed Computing and Applications to Business, Engineering & ScienceThe authors' goal in this paper has been to define a minimal and orthogonal DSEL (Domain-Specific Embedded Language) that would add parallelism to an imperative language. It will be demonstrated that this DSEL will guarantee correct, efficient ...
A data flow language to develop high performance computing DSLs
WOLFHPC '14: Proceedings of the Fourth International Workshop on Domain-Specific Languages and High-Level Frameworks for High Performance ComputingDeveloping complex scientific applications on high performance systems requires both domain knowledge and expertise in parallel and distributed programming models. In addition, modern high performance systems are heterogeneous, thus composed of ...
Comments