cpsc 689: discrete algorithms for mobile and wireless systems
DESCRIPTION
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems. Spring 2009 Prof. Jennifer Welch. Lecture 30. Topic: Virtual Node Layers Sources: Dolev, Gilbert, Lynch, Shvartsman, Welch. Geoquorums. Dolev, Gilbert, Lynch, Schiller, Shvartsman, Welch. Virtual Mobile Nodes. - PowerPoint PPT PresentationTRANSCRIPT
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems
Spring 2009
Prof. Jennifer Welch
Discrete Algs for Mobile Wireless Sys 2
Lecture 30 Topic:
Virtual Node Layers Sources:
Dolev, Gilbert, Lynch, Shvartsman, Welch. Geoquorums. Dolev, Gilbert, Lynch, Schiller, Shvartsman, Welch. Virtual Mobile Nodes. Chockler, Gilbert. Virtual Infrastructure for collision-prone wireless networks. Gilbert PhD thesis. Virtual Infrastructure for wireless ad hoc networks. Brown, Gilbert, Lynch, Newport, Nolte, Spindel. The Virtual Node Layer: A
programming abstraction for wireless sensor networks. Dolev, Gilbert, Lahiani, Lynch, Nolte. Timed virtual stationary automata. Dolev, Lahiani, Lynch, Nolte. Self-stabilizing mobile node location
management and message routing. Gilbert, Lynch, Mitra, Nolte. Self-stabilizing mobile robot formations with
virtual nodes. Nolte PhD thesis. Virtual stationary automata for mobile networks. MIT 6.885 Fall 2008 slides
Discrete Algs for Mobile Wireless Sys 3
Overview Platform: Mobile computers with sensors, actuators, wireless
communication. People, robots, vehicles, could use this hardware to:
Establish ad hoc networks. Coordinate in running applications:
Collect and process data Produce models of the environment Plan activities, disseminate plans
Examples: Rescue workers in disaster areas Soldiers in battle Robots exploring a novel location Cars on highway
But application design for MANETs is very hard, because the networks change unpredictably.
Discrete Algs for Mobile Wireless Sys 4
To simplify application design: Virtual Node Layer, consisting of:
Virtual Nodes, Client Nodes, and A Local Broadcast service.
Virtual Nodes: Simple abstract machines. Better behaved than physical nodes,
e.g., stationary, fail less often. Fail by stopping, recover by restarting
in initial state. Client Nodes similar to physical nodes. Makes it easier to write applications.
Application
Virtual Node Layer
Discrete Algs for Mobile Wireless Sys 5
Virtual Node Layer
Discrete Algs for Mobile Wireless Sys 6
Virtual Node layer
Discrete Algs for Mobile Wireless Sys 7
Route message to a designated geographical
region
Geographical routing (Geocast)
Discrete Algs for Mobile Wireless Sys 8
Gather, aggregate,
analyze, and distribute data.
Data management
Discrete Algs for Mobile Wireless Sys 9
Coordinate activities of robots, people, vehicles
in a region.
Region coordination
Discrete Algs for Mobile Wireless Sys 10
Geoquorums
Goal: Implement atomic Read/Write memory in MANETs.
Read Write
Discrete Algs for Mobile Wireless Sys 11
Geoquorums Uses a Virtual Object Layer:
Passive Virtual Objects, at fixed, normally-populated geographical locations.
Client Nodes, which can access the VOs directly.
Emulate the VO Layer over the MANET, using Replicated State Machine algorithm and a standard geographical routing algorithm.
Implement Read/Write memory over the VO layer, using a quorum-based algorithm.
Atomic Memory
Virtual Object Layer
Discrete Algs for Mobile Wireless Sys 12
Virtual Mobile Nodes
New kind of Virtual Node: Active agent, not just a passive object. Moves according to a pre-planned trajectory.
Applications: Pick up, deliver messages. Highway control: VMN can
notify cars about hazards ahead, ambulance approach from behind.
Discrete Algs for Mobile Wireless Sys 13
An ambulance is coming.Get out of the left lane.
Traffic jam ahead. Slow down.Consider another route.
High Tech Highway
Discrete Algs for Mobile Wireless Sys 14
Emulating Virtual Mobile Nodes
Replicated State Machines. Similar to emulation of Virtual Objects. It’s all relative:
is the same as:
Discrete Algs for Mobile Wireless Sys 15
Virtual Stationary Nodes
Simplest and most important special case of Virtual Mobile Nodes---no motion!
New VSN model, with more control over timing. Leader-based implementation. Self-stabilizing.
Discrete Algs for Mobile Wireless Sys 16
Application: Point-to-point message routing in MANETs
Geographical routing over VSN layer. Mobile client location service.
Keeps track of locations of Client Nodes. Each Client Node has home location VSNs, which keep
track of its current VN region. Determined by hash function from Client Node id.
Client Node sends its physical location to its home locations, using geographical routing.
Requester sends location queries to home locations, also using geographical routing.
Point-to-point message routing between Client Nodes. Based on geographical routing and location service.
Discrete Algs for Mobile Wireless Sys 17
Application: Motion Coordination
Use VSNs to coordinate motion of Client Nodes: VSN can gather, analyze information about its local
region, exchange information with neighboring VSNs, plan motion of CNs.
CNs can use advice from nearby VSNs to determine their motion.
Examples: Robot motion coordination Highway control, using computers on board the cars. Air-traffic control
Discrete Algs for Mobile Wireless Sys 18
Robot Motion Coordination
Given a curve, and a set of Client Nodes (robots) at arbitrary locations, move the Client Nodes so that they are (nearly) all on the curve, and (approximately) evenly spaced.
E.g., perimeter of hazardous waste area.
Discrete Algs for Mobile Wireless Sys 19
VN
VN
VN
VN
VN
VN
Virtual Node Approach Divide region into zones, one VN per zone. VN coordinates Client Nodes in its zone. Directs motion of CNs in its zone:
Towards the curve. On the curve, to even out spacing.
Communicates with neighboring VNs, sends “extra” clients to neighboring zones.
CN
CN
Discrete Algs for Mobile Wireless Sys 20
Virtual Traffic Light (VTL)
For an intersection without a real traffic light.
Computers in cars can emulate a VN, programmed to be a traffic light.
Any policy desired, e.g., 30 sec in each direction.
Cars just see “red” or “green”, on local displays.
VTL dies when no cars are around. But then we don’t need a traffic
light.
Discrete Algs for Mobile Wireless Sys 21
Virtual Air-Traffic Controllers (VATCs)
Aircraft in regions of airspace without ground-based controllers, e.g., the ocean.
Need algorithm for arbitrating access to regions.
Use VATCs, emulated by computers on the aircraft.
VATC behaves like human ATC, e.g.: Keeps track of aircraft in local region. Tells neighboring ATCs when it’s OK to
hand off an aircraft. Tells aircraft how to move within the local
region. VATCs compatible with current ATC system.
Discrete Algs for Mobile Wireless Sys 22
Virtual Node Layers in Unreliable MANETs
Nice theoretical results…but: They all assume reliable communication. Real MANETs have lost messages, collisions:
How to cope with message losses? Three approaches:
1. Mask communication failures, using Contention Manager, Collision Detector services.
2. Implement VNs that have weaker semantics.3. Self-stabilization.
Discrete Algs for Mobile Wireless Sys 23
1. Masking Communication Failures
Contention Manager: Gives “active/passive” advice to each node, at each round. Eventually, advises one node per round to be “active”. Implemented by backoff protocols.
Collision Detector: Notifies receiver that it might have missed a message, because of a
collision (). Completeness: Situations when must be delivered.
When some message is lost, or When half or more are lost, or When a majority are lost, or When all are lost.
Accuracy: Situations when may be delivered. Accurate: When some message is lost, or Eventually Accurate
Discrete Algs for Mobile Wireless Sys 24
Virtual Node Layers for Networks with Message Losses
Mobile network model: Message collisions, losses Contention manager Collision detector
New algorithm to emulate VN layer over unreliable MANET layer.
Uses consensus-like strategy. Application: Tracking
Discrete Algs for Mobile Wireless Sys 25
2. Weaker Semantics A simple reactive VN layer
Simple timing-independent state machines, which react to the arrival of a message by changing state and producing some new messages to send.
With message losses, VNs have an additional failure mode: Can jump to some other “sensible” state---one
that would result from receiving some subset of the messages that have been sent.
Discrete Algs for Mobile Wireless Sys 26
3. Self-Stabilization Mobile networks are subject to unpredictable failures,
changes. Try as we might to mask problems, sometimes, things will
go wrong. Self-Stabilization: No matter what state the system winds
up in, it will gravitate back (quickly) to normal behavior. A standard notion for traditional distributed algorithms:
[Dijkstra’s famous paper, 74] [Dolev’s book, 00]
Discrete Algs for Mobile Wireless Sys 27
Self-Stabilizing Algorithms for Mobile Networks
Problems for which Lynch's group has SS solutions using VN layers: Communication:
Geographical broadcast: Broadcast a message to everyone in the vicinity of a specified geographic location.
Point-to-point message communication: Allow clients to send messages to nodes with specified ids, wherever they are in the network.
Robot motion coordination: Arrange robots along a known curve in the 2-
dimensional plane, approximately evenly spaced.
[Tina Nolte PhD thesis, completed October, 2008]
Discrete Algs for Mobile Wireless Sys 28
Some Details
Geoquorums [Dolev, Gilbert, Lynch, Shvartsman, Welch 03,
04] [Gilbert PhD thesis 07]
Discrete Algs for Mobile Wireless Sys 29
GeoQuorums
Virtual Object layer definition Client Nodes Virtual Object automata CNs invoke operations on
Virtual Objects from anywhere in the network, receive responses.
No other communication mechanism
Emulation algorithm
Discrete Algs for Mobile Wireless Sys 30
Virtual Object Layer Definition Client Nodes
(Untimed) I/O automata Move arbitrarily Fail/recover Frequent geo-updates:
Real time Current location
Unique identifiers Have outputs that are invocations of operations on the
VOs, inputs that are responses. Virtual Object automata
Discrete Algs for Mobile Wireless Sys 31
Virtual Object Layer Definition
Client Nodes Virtual Object automata
Atomic Object I/O Automata: Internal copy of object data
+ input buffers for requests + output buffers for responses.
[Lynch, Distributed Algorithms, Chapter 13]
Fail/recover. Associated with
predetermined locations in space.
Discrete Algs for Mobile Wireless Sys 32
Virtual Object Layer Emulation Physical network
assumptions: Physical mobile nodes
(Untimed) I/O automata Move arbitrarily,
fail/recoverGeo-updates: time,
location.Unique identifiers
Communication: Reliable local broadcast service, within each VO region.
Discrete Algs for Mobile Wireless Sys 33
Summary: Geoquorums VO Layer consists of Client Nodes + Virtual Objects, where
any client can access any object. Provides relatively stable, persistent data objects, in badly-
behaved mobile network.
Assumes Physical Layer, just Physical Nodes + reliable local broadcast.
Emulation uses: Standard GeoCast algorithm. A highly redundant replicated state machine strategy to
emulate each VO. Depends on reliability of local broadcast.
Discrete Algs for Mobile Wireless Sys 34
Some More Details
Virtual Stationary Nodes [Gilbert PhD thesis 07] [Dolev, Gilbert, Lynch, Schiller, Shvartsman,
Welch 04]
Discrete Algs for Mobile Wireless Sys 35
Virtual Stationary Nodes
VSN Layer definition Client Nodes VSN automata Local broadcast communication
Differences from VO Layer: VSNs are active agents, not just
passive objects. Broadcast communication, not
invocation/response. Local communication only.
Discrete Algs for Mobile Wireless Sys 36
VSN Layer Definition
Client Nodes: Essentially as before (Untimed) I/O automata Move arbitrarily Fail/recover Geo-updates Unique identifiers
VSN automata: Active agents, not passive objects (Untimed) I/O automata Associated with predetermined locations in space. Fail/recover Geo-updates (time) Unique identifiers
Local broadcast communication service VCast: CN to nearby CNs VN to/from CNs in its region. VN to neighboring VNs.
Discrete Algs for Mobile Wireless Sys 37
VSN Layer Emulation Physical network
assumptions: As before. Physical mobile nodes
(Untimed) I/O automata Move arbitrarily,
fail/recoverGeo-updatesUnique identifiers
Communication: Reliable local broadcast service, within each VSN region.
Discrete Algs for Mobile Wireless Sys 38
Summary: VSN Layers VSN Layer: Client Nodes + Virtual Stationary Nodes +
local broadcast communication service. Provides a relatively stable, reliable, static overlay network. Many applications.
Physical Layer: Physical Nodes + reliable local broadcast. Emulation uses highly redundant replicated state machine
strategy to emulate each VSN. Depends on reliability of local broadcast.
Discrete Algs for Mobile Wireless Sys 39
Some More Details
Virtual Mobile Nodes [Gilbert PhD thesis 07] [Dolev, Gilbert, Lynch, Schiller, Shvartsman,
Welch 04]
Discrete Algs for Mobile Wireless Sys 40
Virtual Mobile Nodes
VMN Layer definition Client Nodes VMN automata Local broadcast communication
Main difference from VSN Layer: The VMNs move, according to predetermined, globally
known trajectories.
Discrete Algs for Mobile Wireless Sys 41
VMN Layer Definition
Client Nodes: As for VSN Layer VMN automata: Active agents
(Untimed) I/O automata Associated with predetermined trajectories in space. Fail/recover Geo-updates Unique identifiers
Local broadcast communication service VCast: CN to nearby CNs VMN to/from nearby CNs VMN to nearby VMNs.
Discrete Algs for Mobile Wireless Sys 42
Virtual Mobile Node (VMN) Notion of a virtual node
Can perform general computation Moves in a controllable pattern, e.g.
Sweep the plane in a regular pattern Pseudorandom walk
Implement on top of physical nodes that move in unpredictable/uncontrollable ways
How? A VMN is replicated at a set of physical nodes that changes as the nodes move in and out of the VMN’s path.
Discrete Algs for Mobile Wireless Sys 43
Physical Network Assumptions
Physical mobile nodes (Untimed) I/O automata Move arbitrarily,
fail/recover Geo-updates Unique identifiers
Communication: Reliable local broadcast
service.
Discrete Algs for Mobile Wireless Sys 44
More on Communication
Physical mobile nodes communicate using a physical broadcast service.
Simplifying assumptions: Every node that remains within distance Rphys
of sender receives the message Upper bound d on delivery time
Strong abstraction of wireless broadcast with a small number of retries.
Discrete Algs for Mobile Wireless Sys 45
VMN Abstraction A VMN has some local state (its code is provided
by application designer) A VMN communicates with other entities, called
clients; a client can be a physical mobile node or other VMN
Communication is through a virtual broadcast service, similar to the physical one:
radius Rvirt
Might repeat, reorder msgs even if physical bcast does not
Discrete Algs for Mobile Wireless Sys 46
Simple Idea to Simulate a VMN Use an “agent”, a dynamic process that jumps from
physical node to physical node in the direction specified by the VMN path
Generalization of, e.g., Nath & Nicolescu, where moving entity is an arbitrary process instead of a message
Drawback: not robust if current host fails or next part of VMN path is not populated by a physical node.
Our solution: Use replication.
Discrete Algs for Mobile Wireless Sys 47
Replicating a VMN Define the mobile point to be circular region of
radius Rmp that moves on the VMN path: at time t, the center of the mobile point is the position of the VMN
Every physical node that is within the mobile point’s current region replicates the state of the VMN and participates in the simulation protocol.
Each participating physical node keeps a copy of the VMN’s state.
Discrete Algs for Mobile Wireless Sys 48
Keeping Replicas Consistent Replicas are kept consistent by exchanging
messages concerning the actions to perform on the replicated state using a totally ordered (TO) broadcast service.
Use standard techniques to implement the TO-bcast: Each msg to be TO-sent has a unique timestamp (clock
time, sender id) Timestamped msg is sent using physical bcast After msg is received, it is not eligible to be delivered (by
the TO bcast service) until > d time after it was sent Deliver eligible msgs in timestamp order
Discrete Algs for Mobile Wireless Sys 49
Properties of TO-bcast
Assume Rphys > 2*Rmp + d*vmax. Then Msgs are TO-recv’d in the order sent,
breaking ties by sender id. If a physical node in the mobile point TO-
sends a msg, then every physical node that stays in the mobile point sufficiently long receives the message (exactly once).
Discrete Algs for Mobile Wireless Sys 50
VMN Simulation Based on Lamport’s replicated state machine
technique (1978), augmented to support joins, leaves, failure, recovery
One VMN simulation process per physical node Collection of simulation processes, physical bcast,
and TO-bcast together will simulate VMN and virtual bcast
Assumption: VMN’s path is fixed and known; thus so is mobile point’s.
Discrete Algs for Mobile Wireless Sys 51
Joining the Mobile Point
when physical node enters mobile point’s region: status := joining TO-send join request w/ timestamp when node TO-recv’s its own join request:
status := listening save subsequent msgs TO-recv’d in pending-actions
when an active node TO-recv’s new join request: TO-send response w/ its copy of VMN’s state
when listening node gets response: status := active set its copy of VMN’s state to that in msg start processing pending actions (more later)
Discrete Algs for Mobile Wireless Sys 52
While in the Mobile Point
Main task is to manage replica of VMN’s state.What can the VMN do? Receive a message from a client (via virtual bcast
service) TO-send msg to all replicas in mobile point when msg is TO-recv’d, enqueue on pending-actions
Initiate an internal or output action periodically check simulated state against state machine
transitions for VMN to see if an action is enabled. if so, TO-send a msg to all replicas in mobile point saying
to simulate this action. when msg is TO-recv’d, enqueue on pending-actions
Discrete Algs for Mobile Wireless Sys 53
While in the Mobile Point (cont’d)
To simulate transitions of the VMN: Periodically dequeue pending-actions If action has not already been simulated:
apply VMN’s transition function to current simulated state and this action
update simulated state if action is to send a msg to a client (and hasn’t
already been sent by another replica): send the msg via the physical bcast service
Discrete Algs for Mobile Wireless Sys 54
Leaving the Mobile Point
When physical node leaves the mobile point’s current region:
status := idle reinitialize copy of VMN’s state discard pending actions
Discrete Algs for Mobile Wireless Sys 55
Failure & Recovery
What if mobile point’s current region becomes depopulated by physical nodes? Current state of VMN is lost.
If no reponse to join request is received within d time:
Set copy of VMN’s state to failure-recovery state (as specified by designer of VMN)
Discrete Algs for Mobile Wireless Sys 56
Relationship between Virtual & Physical Broadcasting
Require Rphys > Rmp + Rvirt + 2*loc-update-interval*vmax When a client sends a msg to the VMN using virtual bcast:
– Client uses physical bcast to send msg to a physical node in the VMN’s mobile point (at time t)
– Physical node in the mobile point TO-sends the msg (by time t+d)
– Each physical node in the mobile point TO-recvs msg (by time t+2d+1)
When VMN sends a msg to a client using virtual bcast– At least one physical node in the mobile point TO-sends VMN’s
intent to do a send– Physical nodes receive and enqueue the message– At least one physical node sends the message via physical
bcast service (duplicates are possible)
Discrete Algs for Mobile Wireless Sys 57
Correctness of VMN Simulation
Formal proof uses timed I/O automata model. For each execution E of the simulating system,
show there exists a corresponding execution E’ of the virtual system.
Proof is by induction on the sequence of actions in E.
E
E’
“forward simulation relation”
Discrete Algs for Mobile Wireless Sys 58
Applications for VMNs Routing msgs: How to send a message to a specific node?
Would like to avoid tracking locations of all nodes flooding
Adapt idea of Chatzigiannakis et al.: Use a single VMN that repeatedly traverses the network
collecting and delivering msgs. Sender waits for VMN to come nearby and then sends to VMN Receiver waits for VMN to come nearby, then sends request for
any msgs destined for it, which VMN answers Use multiple VMNs to improve latency
Latency and space usage scale with number of VMNs and region size, not number of nodes
Discrete Algs for Mobile Wireless Sys 59
Applications for VMNs Routing a msg to a VMN: since VMN paths
are known, a third VMN shuttles between sender and destination VMNs carrying the message.
S D
M
Discrete Algs for Mobile Wireless Sys 60
Applications for VMNs Use VMNs to traverse the network and
collect sensor data, process it and answer queries
Differs from routing in that data may be aggregated, both regionally and temporally, as it is being collected
Discrete Algs for Mobile Wireless Sys 61
Applications for VMNs
Group communication services Dolev et al. (2002) showed how to
implement group communication services using a single mobile agent that performs a random walk
Use a robust VMN, instead of a fragile token, to collect and deliver group information
Discrete Algs for Mobile Wireless Sys 62
Applications for VMNsAtomic read-write memory: GeoQuorums algorithm (Dolev et al. 2003)
implements a virtual shared variable based on fixed-location densely populated regions, which maintain replicas of the data that are manipulated with quorum-based algorithms.
Instead, use VMNs to maintain the replicas of the shared variable: can adapt if densely populated areas move can move nearer to areas of the network that issue many
operations on the shared variable
Discrete Algs for Mobile Wireless Sys 63
Discussion
VMN abstraction can ease the task of designing algorithms for MANETs by providing programmable motion some robustness
Drawbacks: depends on a reliable and timely physical communication
service assumes a trusted environment expensive in terms of communication and power
consumption
Discrete Algs for Mobile Wireless Sys 64
Open Questions How to optimize for implementation?
Elect a temporary leader in the mobile point which would initiate all transitions on replicas
Keep replica state when leaving mobile point and get incremental updates on rejoining
Relax strong synchrony assumption using partially synchronous bcast algorithms (e.g., Lamport 1998, Bar-Joseph et al. 2002)
Develop a self-stabilizing simulation Determine paths of VMNs on the fly, e.g.,
Track a moving entity Avoid unpopulated areas
Generate new VMNs dynamically, e.g., A new VMN for each entity that enters a geographical area
Discrete Algs for Mobile Wireless Sys 65
Summary: VMN Layers
VMN Layer: Client Nodes + Virtual Mobile Nodes + local broadcast communication service.
Physical Layer: Physical Nodes + reliable local broadcast.
Emulation uses highly redundant replicated state machine strategy to emulate each VMN.
Depends on reliability of local broadcast.
Discrete Algs for Mobile Wireless Sys 66
Message Losses
All this work so far assumes that message delivery is reliable.
But what if it isn’t? (and in real mobile networks, it isn’t…)
Discrete Algs for Mobile Wireless Sys 67
More Details
Masking communication failures, using consensus and collision detectors. [Gilbert PhD thesis 07] [Chockler, Gilbert, Lynch PODC 08]
Discrete Algs for Mobile Wireless Sys 68
Masking Communication Failures Unreliable wireless broadcast model:
Synchronous rounds Physical Nodes: mobile, fail/recover, geo-update, identifiers. Local wireless broadcast:
Broadcast: Within radius R. Interference: Up to radius R’.
Message losses, collisions.
Assume additional services: Collision Detector Contention Manager
R R’
Discrete Algs for Mobile Wireless Sys 69
Eventual Collision-Freedom Eventually, if only one node in a local area broadcasts in a
round, then its message will be delivered. “Eventually” here replaces a probabilistic assumption.
Discrete Algs for Mobile Wireless Sys 70
Collision Detector
Complete: Detects if any message is lost.
Eventually accurate: Eventually no false positives.
Alice
Bob
CD
Bob either:• Gets both messages or• Detects a collision
Discrete Algs for Mobile Wireless Sys 71
Contention Manager
Reduces contention/collisions Example: Backoff protocol
Each node contends when it wants to broadcast. Contention manager issues advice to contending nodes:
active: It is safe for the node to broadcast. passive: The node should not broadcast.
Contention Manager Properties: Eventually non-interfering: Eventually, nearby nodes are not
advised to be active. Eventually regionally fair: Eventually, in any region, if some
node contends for sufficiently long, then some contending node is advised to be active for sufficiently long.
Discrete Algs for Mobile Wireless Sys 72
Emulating Virtual Infrastructure
Replicated State Machine, for each VN
Discrete Algs for Mobile Wireless Sys 73
Emulating a Virtual Node
Each participant is a replica. Replicas execute a
consistency protocol. Leader + backups Leader sends, receives
messages on behalf of the VN.
Join/leave protocol.
Discrete Algs for Mobile Wireless Sys 74
Consistency: First Attempt Use a fault-tolerant distributed consensus algorithm. For each virtual round:
Emulating nodes run a consensus algorithm, to agree on: Messages for VN to receive. Message for VN to send. VN state update.
Emulators update their own copies of the VN state. Leader sends message on behalf of the VN.
Problem: Consensus does not terminate until
collisions stop. Leads to unbounded-sized,
unsynchronized virtual rounds.
Discrete Algs for Mobile Wireless Sys 75
VN Layer Definition
Client Nodes, Virtual Nodes Communication:
CN-CN, CN-VN, VN-VN VN Layer messages may also be lost. Detect collisions when a message is lost (using VN
Layer Collision Detector). Synchronous rounds
Rounds are constant length
Discrete Algs for Mobile Wireless Sys 76CHAk4
Sequence of instances k1, k2, k3,… For each instance k:
Each node proposes an input. Each node receives a history output h, or .
Convergent History Agreement (CHA)
CHAk4
propose(x)
propose(y)
propose(z)
CHAk1
CHAk2
CHAk3
CHAk5
CHAk6
CHAk7
h1
h2
Discrete Algs for Mobile Wireless Sys 77CHAk4
A history is a sequence of proposals, one per instance, e.g.:
Validity: Each proposal for an instance k that appears in an output history is someone’s actual proposal for instance k.
Agreement: Any two output histories for instances k1 and k2, k1 ≤ k2, share a common k1-prefix.
Liveness: For some k, every output for any instance k’ k is an actual history (not ), in which all the elements for instances k,…k’ are actual proposals (not ).
CHA
CHAk1
CHAk2
CHAk3
CHAk5
CHAk6
CHAk7
Discrete Algs for Mobile Wireless Sys 78
Emulating a Series of Virtual Rounds Using CHA
CHA instance k: Proposals are for messages the VN should receive at round k. Returned histories indicate agreed-upon messages for VN to receive at
rounds ≤ k. At round k, each Physical Node i:
Broadcasts any Clienti messages, receives other Client messages. Decides which messages should be received by VN at round k, and
proposes them to CHA instance k. If CHA outputs , PNi doesn’t know what the VN receives, doesn’t emulate
the VN, but emulates Clienti detecting a collision. If CHA outputs a history:
Emulates the VN receiving the messages indicated in the history, through round k.
When appears in the history, emulate the VN receiving no messages but detecting a collision.
(If leader) Determines, broadcasts VN’s output messages for round k.
Discrete Algs for Mobile Wireless Sys 79
CHA Protocol, Instance k
Simplified version: version in the paper has optimizations to reduce communication.
Each node begins instance k with a proposal for the current instance, and a history through instance k-1.
Ballot := (history, proposal) Three rounds:
Round 1 [ballot]: If advice = active then broadcast(ballot)
Round 2 [veto1]: If collision occurred in round 1 then broadcast(veto)
Round 3 [veto2]: If collision occurred in round 2 then broadcast(veto)
• Generate new history through instance k:
Discrete Algs for Mobile Wireless Sys 80
Generate New History
Use colors: If green or yellow, use the (unique) history you received in round 1,
augmented with the associated proposal. If orange or red, use the history from your most recent green or yellow
round, augmented with s.
red
orange
yellow
green
ResultVeto 2Veto 1Ballot Accept
Reject
Discrete Algs for Mobile Wireless Sys 81
CHA output
red
orange
yellow
green
ResultVeto 2Veto 1Ballot
If round is green, then output your new history. If round is yellow, orange, or red, then output .
Discrete Algs for Mobile Wireless Sys 82
Analysis: Key Idea 1
For any instance k, the colors assigned by any two nodes differ by at most one shade.
If some node assigns green to instance k, then all nodes assign either green or yellow.
If some node “accepts the ballot” and outputs a history for instance k, then all nodes receive the ballot for instance k, and use it to define their new histories.
If some node assigns red to instance k, then all nodes assign either red or orange.
If some node “rejects the ballot” at instance k, then no node uses it to define its new history, and no node outputs a history at instance k.
Discrete Algs for Mobile Wireless Sys 83
Analysis: Key Idea 2
After the network, collision detector, and contention manager stabilize, eventually, every round is green.
When the underlying network is well-behaved, then ballots are received, and no vetoes are received.
Used to prove liveness properties for the emulated VN:
Eventual collision freedom. Eventual accuracy of the collision detector. Contention manager eventually well-behaved.
Discrete Algs for Mobile Wireless Sys 84
Emulating Entire VN Layer
Emulate each VN. Complications:
1. Must also emulate communication between VNs.2. VN emulators may interfere with each other, causing collisions.
Coping with the complications: Define static schedule for VN broadcasts:
Non-conflicting: Neighboring VNs are not scheduled at the same virtual round.
Fair: Every VN is scheduled periodically. Use schedule to avoid contention in VN emulation. Use 2 instances of CHA:
One for all the scheduled VNs. to agree on messages they broadcast and receive in virtual round k,
The other for unscheduled VNs, to agree on messages they receive in round k.
Discrete Algs for Mobile Wireless Sys 85
Summary: Masking Communication Failures
VN Layer: Client Nodes + Virtual Stationary Nodes + local broadcast communication service + collision detector + contention manager.
Physical Layer: Physical Nodes + unreliable local broadcast + collision detector + contention manager.
Emulation: Replicated state machine strategy, with leaders to
reduce communication. Convergent History Agreement (CHA) consensus
protocols for emulators of each VN to agree on messages sent and received.
Static scheduling, to emulate multiple VNs concurrently.
Discrete Algs for Mobile Wireless Sys 86
Summary: Masking Communication Failures
CHA emulation guarantees strong consistency semantics for emulated VN Layer.
Protocol is fairly heavyweight. Still could fail in practice: Depends on
reliable collision detection, various “eventual properties”.