First-Class Monadic Schedules


Rajiv Mirani and Paul Hudak


Parallel functional languages often use meta-linguistic annotations to provide control over parallel evaluation.  In this paper we explore a flexible mechanism to control when an expression is evaluated: first-class monadic schedules.  We discuss the advantages of using such first-class values over traditional annotation-based systems.  In particular, it is often desirable to make decisions about the operational behavior of parallel programs depending on the dynamic state of the system.  For example, we may want to measure the system load before deciding to evaluate expressions in parallel.  For this purpose, we show how monads can be used to access dynamic system parameters in a referentially transparent manner (up to termination).

As a mechanism to reason about schedules, we present a set of algebraic properties that any implementation of schedules must satisfy.  We also describe an implementation that translates schedules into a dialect of Scheme extended with futures.  We prove that this implementation satisfies the given set of algebraic properties, and give performance results for a parallel solution to the n-body problem using the Barnes–Hut method.

Although our ideas were developed specifically for nonstrict functional languages such as Haskell, we briefly discuss how they can be used with strict functional languages and imperative languages as well.


    ,author={Mirani, Rajiv and Hudak, Paul}
    ,title={First-Class Monadic Schedules}
    ,journal = "ACM Transactions on Programming Languages and Systems"