1 / 40

Macro-programming Wireless Sensor Networks using Kairos

Macro-programming Wireless Sensor Networks using Kairos. Ramakrishna Gummadi. Ramesh Govindan, Omprakash Gnawali USC. What is Macro-programming?. Writing a single centralized program that describes the global behavior of a task on the entire sensor network

Download Presentation

Macro-programming Wireless Sensor Networks using Kairos

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Macro-programming Wireless Sensor Networks using Kairos Ramakrishna Gummadi Ramesh Govindan, Omprakash Gnawali USC

  2. What is Macro-programming? Writing a single centralized program that describes the global behavior of a task on the entire sensor network Example: To build a shortest path tree rooted at N, the centralized program must capture the global behavior: For each node n in the network, its parent is that neighbor whose distance to N is shortest.

  3. Compiler CentralizedProgram Localized Binary Link + distributewith runtime Link + distributewith runtime Link + distributewith runtime What is Macroprogramming? (contd…) The macroprogramming environment translates this centralized program into programs that execute on individual nodes after adding some runtime support In the shortest path tree example, the localized binary might poll the node’s neighbors about current distances to N, and process and pick the correct parent

  4. Advantages • Easier to describe the centralized version of a distributed computation • Top-down, linear • Easier to reason about correctness • Can even construct formal proofs on a single program using standard techniques (Hoare logic, etc.)

  5. Main Challenges • Abstractions • Basic • How should the network be exposed, how to do distributed control and data flow, etc. • How to be language agnostic • Advanced • Allow dynamic user-level control of heterogeneity, resource management,… • Robustness • How to programmably discover, recover from, and tolerate faults • Efficiency • How to minimize energy consumption by optimizing network traffic

  6. Main Challenges • Abstractions • Basic • How should the network be exposed, how to do distributed control and data flow, etc. • How to be language agnostic • Advanced • Allow dynamic user-level control of heterogeneity, resource management,… • Robustness • How to programmably discover, recover from, and tolerate faults • Efficiency • How to minimize energy consumption by optimizing network traffic

  7. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Results • Conclusion

  8. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Results • Conclusion

  9. Macro-programming Abstractions Support Global behavior Local Behavior Composition Distribution & Safe Execution Automatic Optimization • Node-independent • TAG, Cougar • DFuse • Node-dependent • Kairos • Regiment • Split-C • Data-Centric • EIP, State-space • Geometric • Regions, Hood Sensorware SNACK Impala Mate Tofu Trickle Deluge Taxonomy of Sensor Network Programming Research

  10. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Results • Conclusion

  11. Kairos Abstractions • Goals (at least for now) • Small, yet expressive set of abstractions • Abstractions for facilitating expressivity rather than performance tuning • Three constructs • Addressing arbitrary nodes • Iterating through one-hop neighbors of a node • Reading remote variables at arbitrary nodes • Eventual consistency semantics

  12. Kairos Abstractions (contd..) • Abstractions implemented as programming primitives • First-class extensions to host language, language-agnostic • Nodes logically named using integer identifiers • node datatype with operators for equality, ordering, type testing, etc. • node_list iterator data type for manipulating sets of nodes • One-hop neighbors using a get_neighbors()call at runtime • Can construct arbitrary topologies by iteration

  13. Kairos Abstractions (contd..) • Remote data access ability • variable@node notation • No restrictions on which remote variables may be read where and when, modulo language scoping, lifetime, and access rules • Effectively, a shared-memory abstraction across nodes • Can implicitly capture distributed data flow and control flow coordination • Only remote reads, not remote writes • Eliminates a large class of subtle distributed programming bugs due to locking, race conditions, etc.

  14. Sensor Node Sensor Node Program Program Kairos runtime Kairos runtime Threadofcontrol syncread/write Threadofcontrol syncread/write Cached Objects Cached Objects Managed Objects Managed Objects Queue Manager Queue Manager Requests Requests Replies Replies Kairos Programming Architecture Kairos pre-processor+ language compiler CentralizedProgram Annotatedbinary Runtimes loosely synchronize cached copies with one another. ~ 1 synchronization per 10,000 instructions for 10Mhz processor, 1000 samples/sec Link + distributeto runtime Link + distributeto runtime Link + distributeto runtime Multi-hop wireless network

  15. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Results • Conclusion

  16. Kairos Example 1: void buildtree(node root) 2: node parent, self; 3: unsigned short dist_from_root; 4: node_list neighboring_nodes, full_node_set; 5: unsigned int sleep_interval=1000; //Initialization 6: full_node_set=get_available_nodes(); 7: for (node temp=get_first(full_node_set); temp!=NULL; temp=get_next(full_node_set)) 8: self=get_local_node_id(); 9: if (temp==root) 10: dist_from_root=0; parent=self; 11: else dist_from_root=INF; 12: neighboring_nodes=create_node_list(get_neighbors(temp)); 13: full_node_set=get_available_nodes(); 14: for (node iter1=get_first(full_node_set); iter1!=NULL; iter1=get_next(full_node_set)) 15: for(;;) //Event Loop 16: sleep(sleep_interval); 17: for (node iter2=get_first(neighboring_nodes); iter2!=NULL; iter2=get_next(neighboring_nodes)) 18: if (dist_from_root@iter2+1<dist_from_root) 19: dist_from_root=dist_from_root@iter2+1; 20: parent=iter2;

  17. Kairos Example (contd..) • Program as written is flexible • To start this tree construction at a pre-set time that is programmed into a base station node with id 0, add a single line before line 7: • sleep(starting_time@0-get_current_time()) • Illustrates eventual consistency on dist_from_root • Sensitive to node failures at lines 17-19 • Can be re-written to be more robust • Ideally, we desire automated and transparent recovery from such faults • Current work

  18. Vehicle Tracking 1: Start (at t = 0) with assuming that the master can be any node in the network, and with an initial estimate for P(xt|Zt) that represents the 2-dimensional grid probabilities of vehicle location xtgiven the past history of sensed input Zt 2: Calculate the new probability of vehicle location at (t +1) P(xt+1|Zt) by using the belief propagation rule, the vehicle dynamics P(xt+1|xt), and position estimates P(xt |Zt ) 3: Sense the environment Zt+1, and compute the grid probability P(Zt+1|xt+1) of receiving such an input from the vehicle given our estimate of its location xt+1 4: Compute the Bayesian grid quantity P(xt+1|Zt+1) that represents the new probabilities of vehicle location on the grid after incorporating the latest sensor sample into the history Zt+1 from P(xt+1|Zt) calculated in step 2, and P(Zt+1|xt+1) calculated in step 3 5: For each node k in the neighborhood of the master, compute the information utility Ikfrom the above quantities 6: Pick as next master that node kmasterthat maximizes Ikand, therefore represents the node closest to the vehicle, and make that the new vehicle tracking master; goto step 2

  19. Pseudocode void track_vehicle() boolean master=true; float grid[MAX_X][MAX_Y], p(xt|zt)[MAX_X][MAX_Y],p(xt+1|zt)[MAX_X][MAX_Y], p(zt+1|xt+1)[MAX_X][MAX_Y], p(xt+1, zkt+1|zt)[MAX_X][MAX_Y], p(zkt+1|zt), p(xt+1|zt+1)[MAX_X][MAX_Y]; …self=get local node id();… node_list full_node_set=get_available_nodes(); for (node iter=get_first(full_node_set); iter!=NULL;iter=get_next(full_node_set)) for(;;) sleep(); if (master) for (int x=0; x<MAX X; x++) for (int y=0; y<MAX Y; y++) p(xt+1|zt)[x][y]=… …zt+1=sense_z();… node_list neighboring_nodes=get_neighbors(iter); for (node temp=get first(neighboring nodes); temp!=NULL; temp=get next(neighboring nodes)) …p(xt+1, zkt+1|zt)[x][y]=p(zt+1|xt+1)[x][y]@temp·p(xt+1|zt)[x][y];…

  20. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Results • Conclusion

  21. Implementation • Compiler generates code to call into runtime • Runtime manages reads/writes to managed objects, and reads to cached objects • In a compiled version, need to implement the binary interface between application and runtime (RBI) to copy these reads and writes Sensor Node Program Kairos runtime Threadofcontrol syncread/write Cached Objects Managed Objects Request/Reply Object Queue Manager Requests Replies

  22. Implementation • Python extended for Kairos • Stargate-based, with motes as radio interfaces • Python extensibility interfaces to redirect to runtime • Embeds python interpreter using embedding API’s • Intelligent push/pull in runtime Python interpreter Comm API Runtime

  23. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Evaluation Results • Conclusion

  24. Testbed Setup • 16 Stargate nodes with Kairos using Emstar for E2E routing, topology management, and reliability • Emstar uses a Mica2 mote on the Stargate as the NIC • Single physical hop, multiple logical hops, S-MAC as the MAC layer • 8-node array of Mica2dots connected through a multiport serial card running 8 emstar processes • /dev/node/<id> interface for send()/recv(); object accesses marshaled into messages by the runtime • Ack-based E2E reliability, with multiple outstanding messages and duplicate sequence number detection

  25. 17 18 19 20 21 22 23 24 9 10 11 12 13 14 15 16 5 6 8 7 2 3 4 Routing Tree Performance • Compared against OPP (baseline) • Refined Directed Diffusion; traffic efficient and code optimized • Flood interests (requests), unicast responses (data) • Measure Convergence Time, Overhead, and Stretch • OPP doesn’t necessarily produce shortest paths, so quantify stretch

  26. Routing Tree Performance (contd..) Kairos < 1.3x OPP

  27. Routing Tree Performance (contd..) Kairos < 2x OPP

  28. Routing Tree Performance (contd..) OPP Stretch Higher as Network Traffic Increases

  29. Localization • Hard-coded pair-wise distances from simultaions • Perturbed distances with white Gaussian (=20mm) • Two scenarios for 24 nodes • Localization error when all nodes are localizable • Vary % of initial beacons

  30. Localization (contd..) Error decreases with increasing network size

  31. Localization (contd..) % of resolved nodes increases with increasing beacon %

  32. Line of vehicle movement Vehicle Tracking • Same vehicle tracking parameters as used in Reich et al. [1] for grid size, vehicle speed, sound RMS, acoustic sensor measurement simulations, sensor placement and connectivity, and DoA sensor measurements • Measure location error and standard deviation

  33. Vehicle Tracking (contd..) K ||xMMSE−x|| ||x− xMMSE||2Avg. Overhead (bytes) 12 42.39 1 875.47 135 14 37.24 1297.39 104 16 34.73 1026.43 89 18 31.52 876.54 76 20 28.96 721.68 67 22 26.29 564.32 60 24 24.81 497.58 54

  34. Vehicle Tracking (contd..) % of DOA ||xMMSE−x|| ||x− xMMSE||2Avg. Overhead (bytes) 0.00% (0/24) 35.12 1376.57 142.3 8.33% (2/24) 31.37 902.64 113.4 16.66% (4/24) 28.45 779.28 108.6 25.00% (6/24) 25.73 629.43 102.9 33.33% (8/24) 23.91 512.76 99.1 41.66% (10/24) 22.85 478.39 97.2 50.00% (12/24) 21.96 443.72 94.5 58.33% (14/24) 20.98 421.27 92.7 66.66% (16/24) 20.07 387.23 89.4 75.00% (18/24) 19.67 342.54 85.6 83.33% (20/24) 19.24 312.09 82.2 91.67% (22/24) 18.97 292.76 79.7 100% (24/24) 18.22 265.18 77.3

  35. Talk Overview • Discuss Related Work • Introduce Kairos • Give Examples in Kairos • Describe Implementation • Show Evaluation Results • Conclusion

  36. Conclusion • Initial explorations into a particular model of macroprogramming • Kairos is simple, expressive, flexible, and has decent real-world performance compared to hand-coded versions • However • Doesn’t fully shield programmers from needing to understand performance • Compiler and runtime are primitive, and don’t optimize for specific communication patterns or topologies • Lacks runtime resource control for predictability • Mote implementation not yet available

  37. Backup Slides

  38. U B B B B U U U B B B U Localization Using Cooperative Multilateration Unlocalizable Localizable Example Localization

  39. Centralized Algorithm for Localization Using Cooperative Multilateration 1: At each node in the network, try to build a localization graph by starting with the node itself and adding all next_hopneighbors of all current nodes in the graph 2: Continue this process of building the localization graph at each unlocalized node, and test whether the graph it is currently considering is localizable 3: if NO then 4: The graph does not yet have enough number of beacon or localized nodes, so the node extends the localization graph with all the next_hopneighbors of the leaf nodes in the graph with the hope of acquiring more localized or beacon nodes in the next round 5: Go back to Step 2) if it has managed to extend the graph with more nodes; otherwise it means the localization graph is the entire network that is not localizable, so give up 6: else if YES then 7: Mark all the nodes in the localization graph as having been localized, and arrange to propagate this information eventually to all the newly localized nodes 8: end if

  40. Pseudocode 1: void iterativeMultilateration() 2: boolean localized=false, not_localizable=false, is_beacon=GPS_available(); 3: node self=get_local_node_id(); 4: graph subgraph_to_localize=NULL; 5: node_list full_node_set=get_available_nodes(); 6: for (node iter=get_first(full_node_set); iter!=NULL; iter=get_next(full_node_set))) //At each node, start building a localization graph 7: participating_nodes=create_graph(iter); 8: node_list neighboring_nodes=get_neighbors(iter); 9: while ((!localized || !is_beacon) && !not_localizable) 10: for (node temp=get_first(neighboring_nodes); temp!=NULL; temp=get_next(neighboring_nodes)) //Extend the subgraph with neighboring nodes 11: extend_graph(subgraph_to_localize, temp, localized@temp2||is_beacon@temp2?beacon:unknown); //See if we can localize the currently available subgraph 12: if (graph newly_localized_g=subgraph_check(subgraph_to_localize)) 13: node_list newly_localized_l=get_vertices(newly_localized_g); 14: for (node temp=get_first(newly_localized_l); temp!=NULL; temp=get_next(newly_localized_l)) 15: if (temp==iter) localized=true; 16: continue; //If not, add nodes adjacent to the leaves of the accumulated subgraph and try again 17 node_list unlocalized_leaves; 18: unlocalized_leaves=get_leaves(subgraph_to_localize); 19: boolean is_extended=false; 20: for (node temp=get_first(unlocalized_leaves); temp!=NULL; temp=get_next(unlocalized_leaves)) 21: node_list next_hop_l=get_neighbors(temp); 22: for (node temp2=get_first(next_hop_l); temp2!=NULL; temp2=get_next(next_hop_l)) 23: extend_graph(subgraph_to_localize, temp2, localized@temp2||is_beacon@temp2?beacon:unknown); 24: is_extended=true; 25: if (!is_extended) not_localizable=true;

More Related