A Distributed Actor Model for Mobile Platforms
Total Page:16
File Type:pdf, Size:1020Kb
DAMMP: A Distributed Actor Model for Mobile Platforms Arghya Chatterjee∗ Srđan Milaković Bing Xue School of Computer Science, Department of Computer Science, Department of Computer Science, Georgia Institute of Technology Rice University Rice University Atlanta, Georgia, USA Houston, Texas, USA Houston, Texas, USA [email protected] [email protected] [email protected] Zoran Budimlić Vivek Sarkar Department of Computer Science, School of Computer Science, Rice University Georgia Institute of Technology Houston, Texas, USA Atlanta, Georgia, USA [email protected] [email protected] ABSTRACT CCS CONCEPTS While mobile computing has seen a trend towards miniaturiza- • Computing methodologies → Parallel programming lan- tion and energy savings for a number of years, the available hard- guages; Distributed programming languages; ware parallelism in mobile devices has at the same time continued to increase. Overall, mobile devices remain resource constrained KEYWORDS on power consumption and thermal dissipation. Aggregating the Actor Model, Selector Model, Mobile Computing, Android Platform, computing capabilities of multiple mobile devices in a distributed Distributed Selectors, Remote Messaging, Remote Synchronization. and dynamic setting, opens the possibilities for performance im- provements, longer aggregate battery life and novel dynamic and 1 INTRODUCTION distributed applications. In this paper, we propose a Distributed Actor Model for Mobile The computational demands on mobile devices are increasing at a Platforms (DAMMP), which includes a) a mobile extension to the rapid pace that is hard to sustain with current device-level energy actor-based Distributed Selector (DS) programming model, along capacities. In this paper, we make a case for using a Distributed with a new implementation for mobile Android devices, b) an exten- Actor Model for Mobile Platforms (DAMMP) to harness the pro- sion to the DS programming model that enables the programmer cessing power of multiple supporting mobile devices, and (when to react and adapt to dynamic changes in device availability, c) an available) supporting servers, so as to increase the responsiveness adaptive mobile-to-server and mobile-to-mobile computation of- and reduce the energy consumption of specific mobile devices that floading model and its implementation on the Android platform, need to process compute-intensive jobs. and d) creation of a dynamic network of heterogeneous Android While mobile devices are not usually associated with distributed devices using both Wi-Fi Soft AP and Wi-Fi Direct’s peer to peer and high-performance computing, past projects including distribut- (P2P) network. ed peer-to-peer file sharing for mobile applications [20] and off- We evaluate the DAMMP framework under ideal thermally- the-grid agricultural distributed mobile applications [21], have controlled usage conditions to show promising scalability and demonstrated real-world impact with distributed mobile applica- performance, and analyze the communication overhead of both tions. However, while most such projects are based on specialized Wi-Fi and Wi-Fi Direct when used as the communication layer hardware, we aim to provide a portable and more extensible frame- for DAMMP. We also evaluate the impact of adaptive offload on work with DAMMP. Some popular scenarios from past work on device-level thermal dissipation in more realistic usage scenarios, image recognition [9, 24] and GPS triangulation [17, 27, 32, 33] help thereby demonstrating possibilities for thermal control and power motivate our model in dynamic and heterogeneous settings: management that can be achieved at the application level with a • Law enforcement agencies in the field may not have ac- distributed actor model. To the best of our knowledge, this work is cess to high-performance computing resources to run a the first cross-platform distributed actor/selector runtime system facial-recognition application, and may have to rely on that can span mobile devices and distributed servers. the computing power of their hand-held mobile devices instead. These compute intensive jobs may not be possible ∗ Also with Computer Science and Mathematics Division, ORNL. to run on a single device, but with the use of DAMMP they Permission to make digital or hard copies of all or part of this work for personal or can transparently create a distributed network of multiple classroom use is granted without fee provided that copies are not made or distributed devices to collaboratively implement the face-recognition for profit or commercial advantage and that copies bear this notice and the full citation algorithm [9]. on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, • Hikers are at a remote location without Internet connec- to post on servers or to redistribute to lists, requires prior specific permission and/or a tivity and with a set of devices with different computing fee. Request permissions from [email protected]. power, battery states and temperatures. A DAMMP ap- ManLang 2017, Prague, Czech Republic © 2017 ACM. 978-1-4503-5340-3/17/09...$15.00 plication can enable them to share GPS data among their DOI: 10.1145/3132190.3132205 devices and triangulate their position using the collective ManLang 2017, September 27–29, 2017, Prague, Czech Republic A. Chatterjee, S. Milaković, B. Xue, Z. Budimlić, V. Sarkar computing power of their devices, while at the same time to the DAMMP runtime (which happen not to require the multiple- managing the power consumption and heat dissipation to mailbox functionality available in selectors). maximize the collective usability and longevity of their ad-hoc distributed system of heterogeneous devices [17]. 2.1 Selector Model Scenarios such as these illustrate a need for a programming The Selector model [14] is an extension of the Actor programming model and system that would allow an easy distribution and redis- model [1] that supports multiple guarded mailboxes (which can be tribution of work that needs to be done, a convenient mechanism enabled or disabled independently) along with the priority-based for the application to adapt to dynamic changes in network topol- processing of messages. It overcomes known difficulties in imple- ogy (such as devices leaving or joining the group), and an effortless menting synchronization and coordination patterns using the pure model for offloading computation to another device as a reaction to actor model. The idea of guarded mailboxes in selectors is inspired dynamic environment changes (such as battery running low or tem- by classical condition variables, in which a thread checks whether perature running high on a device). We believe that the DAMMP a condition is true before continuing execution in a critical section. programming model and runtime is well suited to addressing this The results in [14] show that Selectors can also be implemented need. DAMMP combines the distributed asynchrony inherent in efficiently, since that work includes performance comparisons with the Actor model (which greatly facilitates migration), the expres- Scala, Akka, Jetlang, Scalaz, Functional-Java and Habanero actor li- siveness of the Selector model (which can express a wider range of braries. However, the implementation described in [14] was limited coordination protocols), distributed execution on ad-hoc networks to a single-node (shared-memory) implementation of the Selector using Wi-Fi Direct, and an Actor-friendly interface between the model in the Habanero Java Library [12]. runtime and the application that allows for an easy implementation of adaptation mechanisms that react to dynamic changes in the 2.2 Distributed Selector Model system (devices joining/leaving, battery running low, temperature The Habanero Java Distributed Selector (HJDS) runtime library [8] rising too high, OS throttling the CPU, etc.). extended the design and implementation of the single-node Selector To the best of our knowledge, this work is the first cross-platform library from [14] to work across multiple distributed server nodes distributed actor/selector runtime system that can span mobile (with one or more JVM instances per node). HJDS makes it possible devices and distributed servers. The specific contributions of this to use selectors as a single unified programming model for both paper are as follows: shared-memory and distributed multi-node execution of a program. (1) We present a Distributed Actor Model for Mobile Platforms The HJDS runtime allows the programmer to focus on imple- (DAMMP), a Java library that extends the Distributed Se- menting algorithms for solving a problem without worrying about lector model [8] to include support for mobile platforms whether the application should run on a shared-memory or distribu- as well as support for dynamic topology changes and re- ted-memory system. The runtime also provides automated system configuration. bootstrap and distributed global termination by terminating the (2) DAMMP includes a clean and intuitive interface for the user entire distributed system when all selectors in the user code have to implement reactions to changes in the system topology been successfully terminated. and configuration. For a single HJDS program, each computing node is set up with (3) An implementation of this programming model on modern a configuration file which can be customized by the user toadjust Android devices. the number of computing nodes, and JVM processes