Message-based concurrency using actors has the potential to scale from multicore processors to distributed systems. However, several challenges remain until actor-based programming can be applied on a large scale. First, actor implementations must be efficient and highly scalable to meet the demands of large-scale distributed applications. Existing implementations for mainstream platforms achieve high performance and scalability only at the cost of flexibility and ease of use: the control inversion introduced by event-driven designs and the absence of fine-grained message filtering complicate the logic of application programs. Second, common requirements pertaining to performance and interoperability make programs prone to concurrency bugs: reusing code that relies on lower-level synchronization primitives may introduce livelocks; passing mutable messages by reference may lead to data races. This thesis describes the design and implementation of Scala Actors. Our system offers the efficiency and scalability required by large-scale production systems, in some cases exceeding the performance of state-of-the-art JVM-based actor implementations. At the same time, the programming model (a) avoids the control inversion of event-driven designs, and (b) supports a flexible message reception operation. Thereby, we provide experimental evidence that Erlang-style actors can be implemented on mainstream platforms with only a modest overhead compared to simpler actor abstractions based on inversion of control. A novel integration of event-based and thread-based models of concurrency enables a safe reuse of lock-based code from inside actors. Finally, we introduce a new type-based approach to actor isolation which avoids data races using unique object references. Simple, static capabilities are used to enforce a flexible notion of uniqueness and at-most-once consumption of unique references. Our main point of innovation is a novel way to support internal aliasing of unique references which leads to a surprisingly simple type system, for which we provide a complete soundness proof. Using an implementation as a plug-in for the EPFL Scala compiler, we show that the type system can be integrated into full-featured languages. Practical experience with collection classes and actor-based concurrent programs suggests that the system allows type checking real-world Scala code with only few changes.
EPFL_TH4874.pdf
openaccess
651.23 KB
Adobe PDF
1c13f52930d45aa264a96f46317d52af