410 likes | 489 Views
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems. Spring 2009 Prof. Jennifer Welch. Lecture 4. Topics: Collision Detection Sources: Whitehouse et al. Chockler et al. MIT 6.885 Fall 2008 slides. Exploiting the Capture Effect. [Whitehouse, Woo, Jiang, Polastre, Culler]
E N D
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch
Lecture 4 • Topics: • Collision Detection • Sources: • Whitehouse et al. • Chockler et al. • MIT 6.885 Fall 2008 slides Discrete Algs for Mobile Wireless Sys
Exploiting the Capture Effect • [Whitehouse, Woo, Jiang, Polastre, Culler] • Certain kinds of radios can correctly receive a strong signal from one transmitter even when there is interference from other transmitters • called capture effect • Used to • differentiate packet collision and packet loss • identify nodes involved in collision Discrete Algs for Mobile Wireless Sys
Capture Effect vs. Acks • In Ack-based approach: • If no packet received, receiver cannot know if it was even sent • If no Ack received, transmitter cannot differentiate packet loss due to collision from channel noise • neither can identify other nodes involved in a collision • Capture augments Ack mechanisms Discrete Algs for Mobile Wireless Sys
Collision Detection in WSNs • Collision avoidance schemes like RTS/CTS don't help with broadcast communication • Common sensor network protocols like flooding and data aggregation are prone to collisions • If a node can differentiate high collision rate from low quality link (say to parent), it can either change transmission schedule or find a new parent • If parent can identify participants in collisions, it can reschedule them • At a minimum, throughput is increased by being able to recovering data from collisions Discrete Algs for Mobile Wireless Sys
Types of Collisions • stronger-first collisions: stronger packet arrives first • radio synchronizes with stronger packet, ignores weaker one, receives stronger packet properly • stronger-last collisions: stronger packet arrives last • radio synchronizes with weaker packet, but reception of later part of weaker packet is corrupted by appearance of stronger packet to which radio synchronizes Discrete Algs for Mobile Wireless Sys
Method • Each packet begins with some preamble bytes • Continually search for a preamble, even during packet reception • If a preamble is found during packet reception (collision is detected): • Synchronize to the new packet • Extract info about old packet from header bytes already received Discrete Algs for Mobile Wireless Sys
Limitations • Only detects stronger-last collisions • could insert some termination bytes and search for them to identify stronger-first collisions (but requires change to packet format) • Not completely transparent to higher layers • applications must avoid inadvertantly including a preamble in the data • Likelihood of detecting collision decreases as packets arrive closer together • might observe just a long preamble Discrete Algs for Mobile Wireless Sys
Experimental Evaluation • In 2-packet experiments: • detected 42% of all collisions w/o changing packet format or MAC protocol • detected 92% of all collisions w/ changed packet format • recovered data 92% of the time, even w/o changing packet format • Also studied a 36-node network under flooding conditions Discrete Algs for Mobile Wireless Sys
Consensus and Collision Detectors • [Chockler, Demirbas, Gilbert, Lynch, Newport, Nolte] • Study the classic fault-tolerant consensus problem in a wireless network subject to collisions • Consensus problem: • each node has an input value • nodes can fail • each nonfaulty node should decide an output value such that • all decisions are equal • common decision was some node's input Discrete Algs for Mobile Wireless Sys
Why Consensus in WSNs? • Many services and applications require devices to coordinate actions (i.e., agree on a course of action) • TDMA scheduling, managing sensors, climate control, assembly line monitoring • Yet WSNs are subject to failures • hardware malfunction, physical damage, battery depletion, enforced hibernation • Thus fault-tolerant consensus is a useful building block for WSN applications Discrete Algs for Mobile Wireless Sys
Model • unknown number of nodes • nodes don't have unique IDs • single-hop radio network • synchronized rounds of communication • collisions: each node can lose any number of the messages sent in each round • collision detector, contention manager, and ECF assumption on network… Discrete Algs for Mobile Wireless Sys
active/passive active/passive active/passive Y/N Y/N Y/N p1 p1 p1 CD CD CD send/recv send/recv send/recv ECF wireless channel Model contention manager Discrete Algs for Mobile Wireless Sys
ECF Wireless Channel • Guarantees that eventually, if only a single node transmits, all nodes receive the message • "Eventually Collision-Free" • better name "Eventually Interference-Free"? • Technically convenient variation on requirement that this property hold sufficiently long • Nodes don't know when this good behavior starts occurring • Without such behavior, difficult or impossible to do much (nodes can't communicate) Discrete Algs for Mobile Wireless Sys
Collision Detectors • Receiver-side • Abstraction of mechanisms that monitor the broadcast medium and notify nodes when message loss is detected • Imperfect • false negatives: miss some collisions • false positives: think something is a collision that is not (e.g., background noise) • Consider a variety of properties and how they affect the solvability of consensus Discrete Algs for Mobile Wireless Sys
CD Properties • Eventual accuracy: eventually no more false positives (only report actual collisions) • Completeness: • 0-complete: reports collision to p only if p receives no messages sent • half-complete: reports collision to p only if p receives less than half of the messages sent • majority-complete: reports collision to p only if p receives half or fewer of the messages sent • complete: reports collision to p only if p fails to receive at least one message sent Discrete Algs for Mobile Wireless Sys
Contention Manager • Encapsulates task of reducing contention on the channel • In each round, CM suggests to each node that it be active (allowed to broadcast) or passive (should be silent) • Eventually CM should suggest only one node be active per round • together with ECF property of network, this ensures that eventually some communication can occur • but what about fairness? Discrete Algs for Mobile Wireless Sys
Communication Stabilization Time • Consensus algorithms can be guaranteed to make progress toward completion only after CST: • after network starts guaranteeing collision freedom (i.e., interference freedom) • after CM starts guaranteeing that exactly one node is told to be active per round • after CD starts guaranteeing accuracy (no more false positives) • After CST, every node receives every message broadcast, and no node detects a collision. • Measure running time by number of rounds after CST Discrete Algs for Mobile Wireless Sys
Consensus Algorithm with Majority-Complete Collision Detectors • est := initial value • repeat until decided: • proposal phase: • if CM suggests "active" then broadcast est • if CD reports "no collision" and recvd-vals not empty then est := min(recvd-vals) • veto phase: • if CD reported "collision" or |recvd-vals| > 1 then bcast "veto" • if CD reports "no collision" and no values received then decide est Discrete Algs for Mobile Wireless Sys
Why Correct? • Termination: • After CST (if not before), guaranteed to have a round with exactly one broadcaster in the proposal phase, and no collisions detected • So no one sends in veto phase and all decide • Validity: all values exchanged are some node's input • Agreement: • silent veto phase means in previous proposal phase each node got 1 value and no collision notifications • so each process got a majority of the messages sent • since majority sets intersect, all got the same value Discrete Algs for Mobile Wireless Sys
Running Time • Termination guaranteed by 2 rounds after CST. • This is asymptotically optimal (can't take less than a constant number of rounds!) Discrete Algs for Mobile Wireless Sys
Consensus Algorithm with 0-Complete Collision Detector • This collision detector is weaker than one in previous algorithm: only guarantees to report collision if all messages sent fail to be received by the node • Algorithm takes more rounds after CST: O(log |V|), instead of 2, where V is the set of possible input values. Discrete Algs for Mobile Wireless Sys
Consensus Algorithm with 0-Complete Collision Detector • est := initial value • Prepare phase: • if CM suggests "active" then bcast est • if CD reports "no collision" and |recvd| > 0 then est := min(recvd) • Propose phase: • for each bit in est do • if bit = 1 then bcast • if bit = 0 and (CD reports "collision" or |recvd| > 0 then decide := false • Accept phase: • if decide = false then bcast "veto" • if CD reports "collision" or |recvd| > 0 then go to Prepare phase Discrete Algs for Mobile Wireless Sys
Why Correct? • If we can wait until after CST: • one (and only one) node will bcast in the prepare phase • all nodes get the same estimate • all nodes agree on the estimate bit by bit in the propose phase and • all nodes decide on the same estimate in the accept phase • Just need to make sure that nodes don't prematurely decide on different values before CST: • this is the purpose of the bit-by-bit check Discrete Algs for Mobile Wireless Sys
Running Time • Takes O(log |V|) rounds after CST • Asymptotically optimal: Theorem 6 shows that any consensus alg in an environment with ECF, strong contention manager and accurate, half complete CD has an execution in which some node does not decide until after round (log|V|)/2 - 1. Discrete Algs for Mobile Wireless Sys
A Tradeoff • Can even give up the ECF property of the network, if the CD is strengthened to be (always) accurate, instead of just eventually accurate, and still solve consensus • When we don't have the ECF property, we don't need the CM to do anything (since even having just one broadcaster does not guarantee that the message gets through) • But if we don't have ECF and only eventually accurate CD, then consensus cannot be solved Discrete Algs for Mobile Wireless Sys
Consensus Algorithm w/o ECF Using Accurate Collision Detector • Circumvents problem of never-ending collisions by searching through a conceptual balanced binary search tree containing all possible input values • Each iteration contains 4 phases: • vote-val: if your input is the value corresponding to current vertex in search tree then bcast vote • vote-left: if your input is in the left subtree of the current vertex then bcast vote • vote-right: … right subtree … • recurse: decide current value OR go to left child OR go to right child OR go to parent (in case of failure) Discrete Algs for Mobile Wireless Sys
12 4 2 6 10 9 1 5 11 3 7 Tree of Values all nodes start here 8 14 13 15 Discrete Algs for Mobile Wireless Sys
Why Correct? • CD ensures that in each round: • each node gets at least one message or a collision notification OR • each node gets no message and no collision notification • All (live) nodes are always "synchronized" at the same vertex of the conceptual search tree • Correct values are decided • Each faulty node can only delay termination by O(log |V|) rounds: drag nodes down toward a leaf, then crash, so they have to backtrack to root Discrete Algs for Mobile Wireless Sys
Running Time • O(f log |V|) rounds, where f is the number of faulty nodes. • Asymptotically optimal Discrete Algs for Mobile Wireless Sys
Consensus Impossible Without Some Collision Detector • Suppose we have ECF network and a strong CM (that eventually indicates the same active node in each round) but no collision detection. • Can't solve consensus! • I.e., periods of reliable communication are not enough for solving consensus unless there is a way to tell when the reliable periods begin. Discrete Algs for Mobile Wireless Sys
Consensus Impossible w/o CD • Proof by contradiction. • Suppose there is a consensus alg A that works with ECF and strong CM but no CD. • Show that there is some execution of A that violates one of the conditions in the definition of the consensus problem. • Create the bad execution based on two helping executions… Discrete Algs for Mobile Wireless Sys
pa Helping Execution alpha • set of nodes A • all nodes start with input 0 • CM always chooses pa to broadcast • no messages are lost • all nodes decide 0 by round k Discrete Algs for Mobile Wireless Sys
Helping Execution beta • set of nodes B • all nodes start with input 1 • CM always chooses pb to broadcast • no messages are lost • all nodes decide 1 by round k pb Discrete Algs for Mobile Wireless Sys
pb pa Bad Execution gamma • set of nodes A U B • nodes in A start with input 0, nodes in B start with input 1 • CM chooses pa and pb through round k, then only pa • all messages are lost b/w A and B through round k, then no messages are lost • nodes in A do same as in alpha • decide 0 • nodes in B do same as in beta • decide 1 • Violates agreement! Discrete Algs for Mobile Wireless Sys
Discussion Question • How does accuracy / eventual accuracy invalidate the previous impossibility proof? Discrete Algs for Mobile Wireless Sys
(log |V|) Lower Bound on Time for Consensus w/ Half-Complete CD • Theorem 6 shows that any consensus alg in an environment with ECF, strong contention manager and accurate, half complete CD has an execution in which some node does not decide until after round (log|V|)/2 - 1. Discrete Algs for Mobile Wireless Sys
Consensus Impossible w/ Eventually Accurate CD but no ECF • Lack of ECF models noisy networks where nodes are never guaranteed to gain solo access to channel long enough to successfully send a message • Similar style argument to previous impossibility result. Discrete Algs for Mobile Wireless Sys
Summary of Main Points • Consensus cannot be solved without some collision detection capability • Consensus can be solved in constant time if CD can detect loss of half or more of the messages • For small value spaces (e.g., binary), consensus can be solved in constant time if CD can only detect loss of all messages • CDs that produce false positives can be used to solve consensus iff they eventually stop doing so and network has ECF property • Perfect CD does not provide significant advantages over "pretty good" CD Discrete Algs for Mobile Wireless Sys
Open Questions • Other useful properties of collision detectors? • What is the "weakest" detector that is still strong enough to solve consensus? • What about a CD that oscillates between good and bad behavior? • Eliminate assumption of synchronized start? • Extensions to multi-hop networks? Discrete Algs for Mobile Wireless Sys