Title: Convergence at the Extremes HPDC meets Tiny Networked Sensors
1Convergence at the Extremes HPDC meets Tiny
Networked Sensors
- David Culler
- Computer Science Division
- U.C. Berkeley
- Intel Research _at_ Berkeley
- www.cs.berkeley.edu/culler
2Characteristics of the Large
- Concurrency intensive
- data streams and real-time events, not
command-response
- Communications-centric
- Limited resources (relative to load)
- Huge variation in load
- Robustness (despite unpredictable change)
- Hands-off (no UI)
- Dynamic configuration, discovery
- Self-organized and reactive control
- Similar execution model (component-based events)
- Complimentary roles (eyes/ears of the grid)
- Huge space of open problems
3Emerging Microscopic Devices
- CMOS trend is not just Moores law
- Micro Electical Mechanical Systems (MEMS)
- rich array of sensors are becoming cheap and tiny
- Imagine, all sorts of chips that are connected
to the physical world and to cyberspace!
4What can you do with them?
Disaster Management
- Embed many distributed devices to monitor and
interact with physical world
- Network these devices so that they can coordinate
to perform higher-level tasks.
- Requires robust distributed systems of
hundreds or thousands of devices.
Habitat Monitoring
5Getting started in the small
- 1 x 1.5 motherboard
- ATMEL 4Mhz, 8bit MCU, 512 bytes RAM, 8K pgm
flash
- 900Mhz Radio (RF Monolithics) 10-100 ft. range
- ATMEL network pgming assist
- Radio Signal strength control and sensing
- I2C EPROM (logging)
- Base-station ready (UART)
- stackable expansion connector
- all ports, i2c, pwr, clock
- Several sensor boards
- basic protoboard
- tiny weather station (temp,light,hum,prs)
- vibrations (2d acc, temp, light)
- accelerometers, magnetometers,
- current, acoustics
6Emerging execution model (at large)
- Application is graph of event-driven components
- robust to huge surges in demand
7...and in the small
Route map
router
sensor appln
application
Active Messages
Radio Packet
Serial Packet
packet
Temp
photo
SW
HW
UART
Radio byte
ADC
byte
Example ad hoc, multi-hop routing of photo
sensor readings
clocks
RFM
bit
8A Operating System for Tiny Devices?
- Traditional approaches
- command processing loop (wait request, act,
respond)
- monolithic event processing
- bring full thread/socket posix regime to
platform
- Alternative
- provide framework for concurrency and modularity
- never poll, never block
- interleaving flows, events, energy management
- allow appropriate abstractions to emerge
9Tiny OS Concepts
- Scheduler Graph of Components
- constrained two-level scheduling model threads
events
- Component
- Commands,
- Event Handlers
- Frame (storage)
- Tasks (concurrency)
- Constrained Storage Model
- frame per component, shared stack, no heap
- Very lean multithreading
- Efficient Layering
Events
Commands
send_msg(addr, type, data)
power(mode)
init
Messaging Component
Internal State
internal thread
TX_packet(buf)
Power(mode)
TX_packet_done (success)
init
RX_packet_done (buffer)
10TinyOS Execution Contexts
Tasks
events
commands
Interrupts
Hardware
11TOS Execution Model
- commands request action
- ack/nack at every boundary
- call cmd or post task
- events notify occurrence
- HW intrpt at lowest level
- may signal events
- call cmds
- post tasks
- Tasks provide logical concurrency
- preempted by events
- Migration of HW/SW boundary
data processing
application comp
message-event driven
active message
event-driven packet-pump
crc
event-driven byte-pump
encode/decode
event-driven bit-pump
12Dynamics of Events and Threads
bit event end of byte end of packet
end of msg send
thread posted to start send next message
bit event filtered at byte layer
radio takes clock events to detect recv
13Event-Driven Sensor Access Pattern
char TOS_EVENT(SENS_OUTPUT_CLOCK_EVENT)()
return TOS_CALL_COMMAND(SENS_GET_DATA)()
char TOS_EVENT(SENS_DATA_READY)(int data)
return TOS_CALL_COMMAND(SENS_OUTPUT_OUTPUT)((data
2) 0x7)
- clock event handler initiates data collection
- sensor signals data ready event
- data event handler calls output command
- common pattern
14Tiny Active Messages
TOS_FRAME_BEGIN(INT_TO_RFM_frame)
char pending TOS_Msg msg TOS_FRAME_END
(INT_TO_RFM_frame) . . . ok TOS_COMMAND(SUB
_SEND_MSG)(TOS_MSG_BCAST, AM_MSG(INT_READING),
VAR(msg))) ... char TOS_EVENT(SUB_MSG_SEND
_DONE)( TOS_MsgPtr sentBuffer) ... TOS_Msg
Ptr TOS_MSG_EVENT(INT_READING)(TOS_MsgPtr val)
... return val
- Sending
- Declare buffer storage in a frame
- Request Transmission
- Naming a handler
- Handle Completion signal
- Receiving
- Declare a handler
- Firing a handler
- automatic
- behaves like any other event
- Buffer management
- strict ownership exchange
- tx done event reuse
- rx must rtn a buffer
15Example multihop network discovery
- message handler
- if this is a new discover message,
- record its source as parent
- retransmit with self as source
16Network Discovery Radio Cells
17Network Discovery
18Multihop Network Topology
19Storage Breakdown (C Code)
3450 B code 226 B data
20DARPA-esq demo
- UAV drops nodes along road,
- hot-water pipe insulation for package
- Nodes self configure into linear network
- Calibrate magnetometers
- Each detects passing vehicle
- Share filtered sensor data with 5 neighbors
- Each calculates estimated direction velocity
- Share results
- As plane passes by,
- joins network
- upload as much of missing dataset as possible
from each node when in range
- 7.5 KB of code!
21Cory Energy Monitoring/Mgmt System
- 50 nodes on 4th floor
- 5 level ad hoc net
- 30 sec sampling
- 250K samples to database over 6 weeks
22Energy Monitoring Network Arch
sensor net
control net
802-11
telegraph
PC
PC
modbus
scada term
UCB power monitor net
Browser
23Huge Space of Open Problems
- Working across levels of abstractions
- ex DC-balanced packet encoding
- low-power listening
- CSMA MAC for highly correlated traffic
- adaptive transmission control when every node is
originating and forwarding traffic
- Packets can carry time and place information
- implicit network discovery
- Scale
- ex discovery for 1,000 nodes with 30 per
cell
- probabalistic flooding
- Long term management
- sleep/wakeup when need to be awake to hear
- in situ network programming
- operating within ambient energy envelop
24Larger Challenges
- Security / Authentication / Privacy
- Programming support for systems of generalized
state machines
- language, debugging, verification
- Simulation and Testing Environments
- Programming the unstructured aggregates
- Resilient Aggregators
- Understanding how an extreme system is behaving
and what is its envelope
- adversarial simulation
- Constructive foundations of self-organization
25and of course
- Mobility
- Efficiency
- Application execution resource estimation
- Automatically interface networks of tiny devices
with grid frameworks
26To learn more
- http//www.cs.berkeley.edu/culler
- http//tinyos.millennium.berkeley.edu/
- http//webs.cs.berkeley.edu/
- http//ninja.cs.berkeley.edu/
27(No Transcript)
28Typical application use of tasks
- event driven data acquisition
- schedule task to do computational portion
char TOS_EVENT(MAGS_DATA_EVENT)(int data)
struct adc_packet pack (struct
adc_packet)(VAR(msg).data) printf("data_event
\n") VAR(reading) data TOS_POST_TASK(FIL
TER_DATA) ...
- 128 Hz sampling rate
- simple FIR filter
- dynamic software tuning for centering the
magnetometer signal (1208 bytes)
- digital control of analog, not DSP
- ADC (196 bytes)
29Tasks in low-level operation
- transmit packet
- send command schedules task to calculate CRC
- task initiated byte-level datapump
- events keep the pump flowing
- receive packet
- receive event schedules task to check CRC
- task signals packet ready if OK
- byte-level tx/rx
- task scheduled to encode/decode each complete
byte
- must take less time that byte data transfer
- i2c component
- i2c bus has long suspensive operations
- tasks used to create split-phase interface
- events can procede during bus transactions
30Deadline avoidance
- Pipelines transmission transmits single byte
while encoding next byte
- Trades 1 byte of buffering for easy deadline
- Separates high level latencies from low level
real-time requirements
- Encoding Task must complete before byte
transmission completes
- Decode must complete before next byte arrives
Encode Task
Byte 2
Byte 1
Byte 3
Byte 4
Bit transmission
Byte 1
Byte 2
Byte 3
start
RFM Bits