230 likes | 241 Views
This paper introduces the Pleiades programming language, which offers centralized programming and automatic program partitioning and control-flow migration for sensor networks. It simplifies programming by offloading concurrency, reliability, and energy efficiency to the compiler and runtime. The paper also presents a mote-based implementation of Pleiades and evaluates several realistic applications.
E N D
Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi (USC), Todd Millstein (UCLA) and Ramesh Govindan (USC)
What are Sensor Networks? • Composed of small battery-powered devices called motes • Communicate using wireless • Primarily programmed in a language called nesC
Micro-habitat monitoring Volcanic activity monitoring Wildlife monitoring Many Compelling Applications! Urban sensing Structural health monitoring Actuation-based sensing
Domain-Specific Challenges • Need to deal with several application-level concerns • Time-critical sensing • Hardware resource constraints • Energy-efficient communication • Concurrency and application logic • Failures • Distributed data consistency • Simultaneously achieving efficiency and reliability while providing readability is hard Efficiency Reliability
Programming Today Node-level program written in nesC Compiled to mote binary Tradeoff: High efficiency, but readability and reliability suffer because achieving global results and maintaining invariants through a local approach is tedious and error-prone
Our Approach: Centralized Programming Central program that specifies application behavior Compiler Node-level nesC programs + Runtime Compiled to mote binary Simplifies programming by offloading concurrency, reliability, and energy efficiency to the compiler and runtime
Our Contributions • The Pleaides programming language • Centralized as opposed to node-level • Automatic program partitioning and control-flow migration • Minimizes energy by optimizing data movement • Easy-to-use and reliable concurrency primitive • Ensures consistency under concurrent execution • Mote-based implementation • Evaluated several realistic applications
Pleiades Constructs by Example Node-local variable int temp LOCAL; void main() { nodelist all = get_available_nodes(); int max = 0; Central variable List of nodes in network cfor for (noden = get_first(all); n!=NULL; n = get_next(all)) { if (temp@n > max) max = temp@n; } } Network Node Concurrent-for loop Access node-local variables declaratively Central variables needn’t be synchronized
Two Main Challenges The Pleiades Compiler and Runtime How to achieve serializability under concurrency How to compile and efficiently execute a centralized program Partitioning Concurrency
Program Execution Control-flow migration as well as data movement val@n1 = a; n3 = val@n2; n1 Nodecut How does the compiler partition code into nodecuts? void main() { ……… val@n1 = a; n3 = val@n2; val@n3 = b; val@n4 = c; ……… } n2 Sequential Program val@n3 = b; val@n4 = c; n3 Control-flow migration n4 How does the runtime know where to execute each nodecut? Access node-local variables from nearby nodes
Our Contributions • The Pleaides programming language • Centralized as opposed to node-level • Automatic program partitioning and control-flow migration • Minimizes energy • Easy-to-use and reliable concurrency primitive • Ensures consistency under concurrent execution • Mote-based implementation • Evaluated several realistic applications
start all = get_available_nodes() 1 max = 0 2 n = get_first(all) 3 if(n!=NULL) True False end 4 if(temp@n > max) True 5 False max = temp@n 6 n = get_next(all) Partitioning Code into Nodecuts Control-flow graph for max example Property: The location of variables accessed within a nodecut are known before its execution Nodecuts generated by the Pleiades compiler
Control-flow Migration Algorithm Runtime attempts to find lowest communication cost node to execute nodecut
Our Contributions • The Pleaides programming language • Centralized as opposed to node-level • Automatic program partitioning and control-flow migration • Minimizes energy • Easy-to-use and reliable concurrency primitive • Ensures consistency under concurrent execution • Mote-based implementation • Evaluated several realistic applications
Cfor execution Challenge: To ensure serializability during concurrent execution Approach: Distributed locking, with multiple reader/single writer locks On completion, cfor iterations send DONE message to originating node Nodecut encountering a cfor forks a thread for each iteration
Distributed Locking 6 max Deadlocks possible, but dealt with using a simple deadlock detection and recovery scheme 10 20 5 10 Technique generalizes to nested cfor loops using hierarchical locking 20 cfor (node n = 1; n < 5; n++) { if (temp@n > max) max = temp@n; } temp@n Only the write operation to max is serialized.
Our Contributions • The Pleaides programming language • Centralized as opposed to node-level • Automatic program partitioning and control-flow migration • Minimizes energy • Easy-to-use and reliable concurrency primitive • Ensures consistency under concurrent execution • Mote-based implementation • Evaluated several realistic applications
Implementation and Evaluation • Compiler built as an extension to the CIL infrastructure for C analysis and transformation • Pleiades compiler generates nesCcode • Pleiades evaluated on TelosB motes • Experience with several applications: pursuit-evasion, car parking, etc. • Compiler built as an extension to the CIL infrastructure for C analysis and transformation • Pleiades compiler generates nesCcode • Pleiades evaluated on TelosB motes • Experience with several applications: pursuit-evasion, car parking, etc.
Related Work • Embedded and Sensor networks languages • Concurrent Systems (e.g.,Transactional Memory) • Parallel Processing Languages (e.g., Split-C, Linda)
Related Work • SpatialViews (Ni et. al., PLDI’05) • Achieve concurrency and reliability by restricting the programming model • Kairos (Gummadi et. al., DCOSS’05) • Does not provide automatic code migration or serializability; support for automatic recovery mechanisms • Regiment (Newton et. al., IPSN’07) • Purely functional language; Cannot update node-local state • COSMOS (Awan et. al., EuroSys’07) • Dataflow programming model; Designed for heterogeneous networks • TinyDB (Madden et. al., TODS’05) • Declarative interface for centrally manipulating data; not Turing complete
Conclusions and Future work • The centralized programming model in Pleiades simplifies programming • Compiler and runtime deal with concurrency, reliability, and efficiency details • Implemented on TelosB motes • Future Work: • Declarative failure recovery for Pleiades • User-defined/relaxed consistency models to improve concurrency
Thanks! More info at: http://kairos.usc.edu