Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi...

download Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi (USC), Todd Millstein (UCLA) and Ramesh Govindan (USC)

If you can't read please download the document

Transcript of Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi...

  • Slide 1

Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi (USC), Todd Millstein (UCLA) and Ramesh Govindan (USC) Slide 2 2 What are Sensor Networks? Composed of small battery-powered devices called motes Communicate using wireless Primarily programmed in a language called nesC Slide 3 3 Many Compelling Applications! Volcanic activity monitoring Urban sensing Micro-habitat monitoring Actuation-based sensing Structural health monitoringWildlife monitoring Slide 4 4 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 Slide 5 5 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 Slide 6 6 Our Approach: Centralized Programming Central program that specifies application behavior Node-level nesC programs Compiled to mote binary Compiler Runtime + Simplifies programming by offloading concurrency, reliability, and energy efficiency to the compiler and runtime Slide 7 7 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 Slide 8 8 Pleiades Constructs by Example int temp LOCAL; void main() { nodelist all = (); nodelist all = get_available_nodes(); int max = 0; int max = 0; (node n = get_first(all); n!=NULL; n = get_next(all)) { if (temp @ n > max) max = temp @ n; } Node-local variable Central variable List of nodes in network Network Node Access node-local variables declaratively for Concurrent-for loop cfor Central variables neednt be synchronized Slide 9 9 Two Main Challenges The Pleiades Compiler and Runtime ConcurrencyPartitioning How to compile and efficiently execute a centralized program How to achieve serializability under concurrency Slide 10 10 void main() { val@n1 = a; n3 = val@n2; val@n3 = b; val@n4 = c; } Program Execution Control-flow migration as well as data movement Control-flow migration Access node-local variables from nearby nodes val@n1 = a; n3 = val@n2; val@n3 = b; val@n4 = c; Nodecut n1 n2 n3 n4 How does the compiler partition code into nodecuts? How does the runtime know where to execute each nodecut? Sequential Program Slide 11 11 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 Slide 12 12 start 1 2 3 6 4 5 end all = get_available_nodes() max = 0 n = get_first(all) False True False True max = temp@n if(temp@n > max) if(n!=NULL) 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 Slide 13 13 Control-flow Migration Algorithm Runtime attempts to find lowest communication cost node to execute nodecut Slide 14 14 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 Slide 15 15 On completion, cfor iterations send DONE message to originating node Cfor execution Nodecut encountering a cfor forks a thread for each iteration Challenge: To ensure serializability during concurrent execution Approach: Distributed locking, with multiple reader/single writer locks Slide 16 16 1020 Distributed Locking cfor (node n = 1; n < 5; n++) { if (temp@n > max) max = temp@n; } 20 10 5 6 temp@n max Technique generalizes to nested cfor loops using hierarchical locking Only the write operation to max is serialized. Deadlocks possible, but dealt with using a simple deadlock detection and recovery scheme Slide 17 17 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 Slide 18 18 Compiler built as an extension to the CIL infrastructure for C analysis and transformation Pleiades compiler generates nesC code 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 nesC code Pleiades evaluated on TelosB motes Experience with several applications: pursuit-evasion, car parking, etc. Implementation and Evaluation Slide 19 19 Pursuit-Evasion in Pleiades Slide 20 20 Related Work Embedded and Sensor networks languages Concurrent Systems (e.g.,Transactional Memory) Parallel Processing Languages (e.g., Split-C, Linda) Slide 21 21 Related Work SpatialViews (Ni et. al., PLDI05) Achieve concurrency and reliability by restricting the programming model Kairos (Gummadi et. al., DCOSS05) Does not provide automatic code migration or serializability; support for automatic recovery mechanisms Regiment (Newton et. al., IPSN07) Purely functional language; Cannot update node-local state COSMOS (Awan et. al., EuroSys07) Dataflow programming model; Designed for heterogeneous networks TinyDB (Madden et. al., TODS05) Declarative interface for centrally manipulating data; not Turing complete Slide 22 22 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 Conclusions and Future work Slide 23 Thanks! More info at: http://kairos.usc.edu