1
play

1 Mate Mate: Architecture Architecture Instruction Set Capsules - PDF document

Outline Motivation Mate Mate: A Tiny Virtual Machine Code Propagation for Sensor Networks Trickle Philip Levis and David Culler Simulation Results Presented by Conclusions & Critiques Mark Tamola CSE 521 Fall 2004


  1. Outline � Motivation � Mate Mate: A Tiny Virtual Machine � Code Propagation for Sensor Networks � Trickle Philip Levis and David Culler � Simulation Results Presented by � Conclusions & Critiques Mark Tamola CSE 521 Fall 2004 1 2 Motivation Applications � Sensors deployed in the field must have a way � Monitoring, surveillance applications to easily upgrade software on network nodes � Sensor nodes may want to change their sampling frequency on the fly � There could potentially be thousands of nodes � May want to create/modify groups of nodes depending on to upgrade environment to reduce false alarms � Structural engineering � Nodes are usually physically unreachable, or � Sensor network of seismic monitoring nodes have already impractical to try to reach shown to be useful � The software download must consume the � The same networks can also be useful for other tasks, such as water damage assessment or testing sound least amount of energy as possible propagation 3 4 Challenges Mate � Network must be reprogrammed as fast as � Mate is one solution to these problems possible � A tiny, embeddable, event-driven virtual machine � Useful for data aggregation and adaptive query � The VM can be application-specific processing � Interprets compact bytecodes (1 byte) that � Communication is more costly than sensor compress high-level functionality into single instructions reading (downloading is expensive) � Provides a simple, scalable code propagation � Power to produce << Power to transmit mechanism � Reprogramming must not require physical contact 5 6 1

  2. Mate Mate: Architecture � Architecture � Instruction Set Capsules � Execution � Code Propagation 1 capsule Heap = 24 bytes 7 8 Mate: Instruction Set Mate: Instruction Set � VM interprets “assembly language”-style � Each Mate instruction is implemented as a instructions TinyOS task � Suited for a stack-based architecture � Mate provides 8 user-definable instructions � 3 classes of instructions (basic, s-class, x- � Provides a mechanism for application-specific, class) high-level instructions � Requires the VM to be rebuilt (in fact, any � S-class instructions are specific for manipulating customization to the VM requires a rebuild) messages for send/receive/monitoring � Some instructions can be overloaded (i.e. � X-class provides one branch instruction, blez (branch on less than or equal to zero) adding two sensor readings vs. adding two messages vs. adding two values) � 3 data types (value, message, sensor read) 9 10 Mate: Instruction Set Mate: Execution � 3 execution contexts that can run concurrently � Clock � Send � Receive � The clock context’s operand stack persists across invocations (makes it easy to do timeouts) � The clock’s frequency and count can be modified from within a Mate program � Send and receive contexts’ stacks are not persistent � Data that is sent or received is expected to be specific to the invocation of the context 11 12 2

  3. Mate: Execution Mate: Execution � Mate’s limited addressing modes ensures � A capsule’s execution is initiated by an event that contexts cannot encroach on another’s � Clock and receive capsules are initiated by these space external events � Send capsules are executed by the “sendr” � The only shared space available is the single instruction byte heap � Execution starts at the first instruction of the capsule and continues until a halt instruction is reached 13 14 Mate: Code Propagation Trickle � Capsules are always tagged with a version � What is it? number � How is Mate using it? � If the VM receives a newer version of a capsule, Mate will install it � The process of how to send a new code version throughout the network is based on the Trickle algorithm 15 16 Trickle Trickle � Provides a maintenance protocol for quickly � A node only hears a “trickle” of the gossip distributing data among many network nodes (available code metadata) present in the network & only sends a “trickle” of the gossip � The algorithm is based on a “polite gossip” (only among its neighbors) paradigm: � This “trickle” of information passing between � “I’ll only gossip about new things that I’ve heard from my neighbors, but I won’t repeat gossip I’ve one node and its neighbors allows gossip to already heard, as that would be rude.” “trickle” through the network, much like a � Using the protocol, code updates “trickle” virus infection through the network; analogous to a virus 17 18 3

  4. Trickle Trickle � New metadata is transmitted periodically by a node � To start the Trickle algorithm, an “infected” � Within a node’s time period: host must initiate the transfer of the new � If a node hears older metadata, it broadcasts the new code capsule to another node � If a node hears newer metadata, it broadcasts its own � This initiates a chain reaction of infection/transfer metadata (which will cause other nodes to send the new for each node code) � The initiating host can become “infected” via � If a node hears the same metadata, it increments a counter � if a threshold is reached, the node doesn’t radio transfer from a nearby base station transmit its metadata � otherwise, it transmits its metadata 19 20 Trickle Trickle c = 0 � 3 main parameters for the algorithm: k = 2 � c: count of how many times identical metadata t = 0 has been heard � k: threshold to determine how many times identical metadata must be heard before suppressing transmission of a node’s metadata v1.1; t = 3 � t: the time at which a node will transmit its metadata � τ : the total time period; t is a value within τ 21 22 Trickle Trickle c = 1 c = 1 I’ve got k = 2 v1.1 k = 2 t = 1 t = 2 v1.1; t = 3 v1.1; t = 3 23 24 4

  5. Trickle Trickle c = 1 c = 1 k = 2 k = 2 t = 3 t = 4 I’ve got v1.1 I’ve got v1.1; t = 3 v1.1; t = 3 v1.1 25 26 Trickle Trickle c = 0 c = 1 I’ve got k = 2 k = 2 v1.1 t = 0 t = 1 v1.1; t = 3 v1.1; t = 3 27 28 Trickle Trickle c = 2 c = 1 k = 2 k = 2 t = 4 t = 3 I’ve got v1.1; t = 3 v1.1; t = 3 v1.1 Yay! I don’t need to broadcast! 29 30 5

  6. Trickle Trickle: Challenges � In a lossy network, � All of this can happen assuming these ideal simulations show that the conditions: number of transmissions � No packet loss increases by O(log n) � Ideally, it would be O(1), � Perfect synchronization between time intervals (all with k being the number of have same initial offset) transmissions, no matter � Single-hop network how many nodes in the neighborhood 31 32 Trickle: Challenges Trickle: Challenges � If the nodes are � Trickle was modified slightly to handle the problem unsynchronized, Trickle of unsynchronized initial times can suffer from the � Instead of picking t from [0, τ ], pick the value from “short-listen” problem [ τ /2, τ ] � This also causes � Also, suppress transmission for all nodes from [0, unnecessary τ /2], and only listen during this period transmissions � This puts an upper bound of 2k on the number of transmissions � Again, with the packet loss rate, this makes it 2k*log(n), which is still O(log n) 33 34 Trickle: Challenges Trickle: Challenges � In very dense, multi- � Physical density: determined by radio range hop networks, Trickle � The “hidden terminal” problem causes suffers from the “hidden dropped packets, making a cluster of nodes terminal” problem, due appear less dense than it actually is to the default CSMA (Observed density) MAC layer of TinyOS � If Observed density < Physical density, then this increases the number of transmissions, since certain nodes won’t be able to transmit in order to increment the Trickle counter (c) 35 36 6

  7. Trickle: Challenges Trickle: Challenges � Fortunately, in practice, τ is usually in the � Load balancing between nodes can also be a order of tens of minutes, so the likelihood of problem the network being saturated within this long � i.e. We don’t want the same node always being time period is unlikely the one to transmit within τ � The paper says the number of transmissions due to the “hidden terminal” problem also increases O(log n) 37 38 Trickle: Challenges Trickle: Notes � One parameter that can definitely tweak the � However, since the number of receptions is performance of Trickle is τ much greater than the number of � A high τ incurs more communication overhead, transmissions, the overall network but faster code discovery communication is smooth � A low τ has less overhead, but slower code discovery � By defining a lower bound, τ L , and an upper bound, τ H , and dynamically scaling between the two, the algorithm can enjoy the best of both worlds 39 40 Trickle: Notes Trickle: Notes � Remember that a node’s t value is randomly chosen within τ 41 42 7

Recommend


More recommend