Low-Power Sensor Networks: A Case Study in Seeking Distributed Predictability
Low-Power Sensor Networks: A Case Study in Seeking Distributed Predictability
Predictable
TinyOS and the specter of low-power
Limited resources and communication Black box operation
Outline
A brief history of: 1.0, 1.1 and 2.0 (T2) T2 core structure, language/OS co-design MNet architecture Real Time?
In the Beginning
(1999)
Sensor networks are on the horizon... ... but what are they going to do?
What problems will be important? What will communication look like? What will hardware platforms look like?
Having an operating system is nice... ... but how do you design one with these uncertainties?
Allow high concurrency Operate with limited resources Adapt to hardware evolution Support a wide range of applications Be robust Support a diverse set of platforms
History
2001 TinyOS 0.63 perl scripts + C WeC + rene (1000) 1999 2000 TinyOS 0.4 perl scripts + C WeC platform (30)
TinyOS Basics
A program is a set of components
Components can be easily developed and reused Adaptable to many application domains Components can be easily replaced Components can be hardware or software Allows boundaries to change unknown to programmer
Hardware is non-blocking
Software needs to be so as well
TinyOS Basics
(2000)
Finished
Finished
Tasks
Finished
Finished
Allow high concurrency (A) Operate with limited resources (A-) Adapt to hardware evolution (B) Support a wide range of applications (B) Be robust (D) Support a diverse set of platforms (B-)
10
Allow high concurrency (A) Operate with limited resources (A-) Adapt to hardware evolution (B) Support a wide range of applications (B) Be robust (D) Support a diverse set of platforms (B-)
11
Interfaces
Establish programming abstraction as a language abstraction Prevent bugs
12
Task Scheduler
Sync
Async
Hardware
Tasks are the interface which transforms async to sync The explicit sync/async distinction allows nesC to detect all data races at compile time Fixed >100 data races in TinyOS (6 races/1000 lines)
14
Outline
A brief history of: 1.0, 1.1 and 2.0 (T2) T2 core structure, language/OS co-design MNet architecture Real Time?
15
TinyOS Evolution
16
Failures of Implementation
17
Failures of Structure
TinyOS 1.x has no resource management Most operations can fail at any time (busy)
Packet transmission Bus access ADC sampling
No component isolation
18
Allocation
19
Concurrency Model
T2 has the same basic concurrency model
Tasks, sync vs. async
TinyOS 1.x
20
T2
Static Binding
Run-time vs. compile time parameters
interface CC2420Register { command uint16_t read(uint8_t reg); command uint8_t write(uint8_t reg, uint16_t val); command uint8_t strobe(); } component CC2420C { provides interface CC2420Register; } interface CC2420StrobeReg { command uint8_t strobe(); } component CC2420C { provides interface CC2420StrobeReg as SNOP; provides interface CC2420StrobeReg as STXONCCA; .... }
21
Static Allocation
You know what youll need: allocate it at compile-time (statically) Depending on probabilities is a bet
I.e., its very unlikely theyll all need to post tasks at once = they will
You know what components will use a resource, can allocate accordingly
In some cases, static allocation can save memory Less defensive programming/error handling
22
TinyOS 1.x
23
T2
25
Each instance of the service can have at most one outstanding packet at any time Like tasks, send fails if and only if a packet is already pending
Application Application
Sender Time
26
Sender Time
27
Sender
Sender
Sender
Sender
Sender
28
29
Router
Packets
30
Interface Contracts
Specify valid call patterns with annotations
Per-interface basis (heavy reuse) Both sides of the interface
Base case: hardware abstractions follow contracts Inductive static, dynamic, run-time checking
Run-time approach has detected several serious bugs in 1.x (which turn out to be impossible by design in 2.0)
31
Outline
A brief history of: 1.0, 1.1 and 2.0 (T2) T2 core structure, language/OS co-design MNet architecture Real Time?
32
Survey of causes
Protocol conicts/interference Collisions and congestion induced loss Neighbor management (with layer 2 scheduling, e.g. TMAC) Dont know!
Management
Give operators a peek into the sensornet black box SNMS [EWSN 2005]: lightweight get/set Sympathy [SenSys 2005]: expert system
34
MNet Principle
The difficulty in deploying and developing sensornets is part of the essence of this class of systems.
Large numbers, limited energy, distributed over space, different views of the environment, noise, local optimizations, etc. This is more than an artifact.
MNet principle: Improve visibility into the internal operation of the network.
Quantify: Minimize the energy required to identify the cause of network behavior.
35
Goal
36
Inter-Protocol Interference
Snooping is a common routing approach
Implicit acks, rate control, backpressure, etc.
One misbehaving protocol can prevent anyone else from performing well
A B C SINK
37
Isolation
If any protocol X, Y, Z can a protocol to fail, then we have a larger (more expensive) state space to explore We need a way to isolate protocols from one another, so they can operate concurrently but not interfere. Mechanism: grant-to-send (GTS)
38
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
39
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
2 0
40
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
2 0
41
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
2 0
42
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
1 0
43
Grant-To-Send
A transmitter may embed a quiet time in a packet. No-one except the destination may transmit for the duration of the quiet time (including transmitter). Sending a packet grants the channel to the receiver.
2 0
44
Fairness
Isolation is insufficient.
The simplest approach is to not let anyone do anything.
Every protocol should receive its fair share of the network bandwidth. Wireless is inherently distributed
Different views of the channel Perfect fairness is not always possible (but we can be close)
45
Fair Queueing
(Demers, Shenker, and Keshav)
P1 P2 P3
46
Uses Grant-To-Send mechanism Sits between CSMA layer and network layer Fair queueing according to the channel occupation
Considers the grant duration as a channel occupation
Network Protocols
FWP
CSMA
47
Ideal case without collisions and packet losses Perfect fairness among nodes and protocols
CSMA allows all nodes to have equal chance of transmission All nodes agree on channel usages of protocols, thus perfect fairness among protocols
Perfect Isolation
Every node waits until the current quiet time expires
48
Loss
Channel Share
1 0.8 0.6 0.4 0.2 0 0 100 200 300
P1 P2 P3
Lost packets can cause inconsistent view of the channel occupation times of protocols Experimental Setting:
Five nodes in single-hop range Three protocols with different quiet times (20ms / 40ms / 80ms)
Time (s)
Normalized share of one node High channel fairness: 0.99 (Jains Fairness Index) However, individual nodes are servicing protocols unevenly Ping-pong Effect
49
P1 T T T+1 T+1
P1 T T T+1 T+1
20 / 40 / 80 ms (Fig. 1)
10 8 6 4 2 0 ARC1 ARC2
51
8
Cost (tx/goodput)
CSMA FWP
Network Protocols
Network Protocols
FWP isolates network protocols from each other How do we isolate causes within a protocol? Apply minimization principle to higher layers
FWP
CSMA
52
1. Retransmit timeout 2. Queue drop 3. False positive duplicate suppression 4. Reboot 5. Kaboom!
53
Decision Tree
No more packets? Requires no querying of network state!
Death/Disconnect
Reboot
High THL?
Suppression
Queue Drop
54
MNet Architecture
Elevate management and visibility to an architectural principle and design goal Isolation of causes Fairness (protocol, node, application...) FWP as the narrow waist
55
Outline
A brief history of: 1.0, 1.1 and 2.0 (T2) T2 core structure, language/OS co-design MNet architecture Real Time?
56
57
Predictability
Being able to assume things will behave in a certain way Breaking outside current approaches
Language-OS co-design Static, dynamic, run-time approaches
58
Questions
59