Compiler support for lightweight concurrency
Kathleen Fisher, John H. Reppy · 2002
This paper describes our approach to implementing the concurrency features of the MOBY programming language. Our approach is based on our direct-style -calculus intermediate representation called BOL, which we have equipped with a weak but cheap form of continuations and primitives to support an abstract model of thread creation, termination, and scheduling. This implementation strategy allows flexibility in both the design of MOBY's surface language concurrency features and in the runtime implementation. In addition, because our support for concurrency is integrated into the compiler's IR, we can use standard IR-based optimizations, such as inlining, to optimize concurrency code. In this paper, we describe BOL's continuations and thread manipulation primitives and illustrate their use in implementing various concurrency operations. We also describe our current implementation, which is a direct mapping onto POSIX threads, and we sketch a possible many-to-many implementation.