Download Scheduling

Document related concepts

CAN bus wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Automated airport weather station wikipedia , lookup

Distributed operating system wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
System Design Issues In Sensor
Databases
Qiong Luo and Hejun Wu
Department of Computer Science and Engineering
The Hong Kong University of Science & Technology
http://www.cse.ust.hk/
Wireless Sensor Networks (WSNs)
Limited on-node resource
Multi-hop communication
Energy efficiency is the most crucial performance factor.
SIGMOD07 Tutorial
SensorDB System Design Issues
2
In-Network Sensor Query Processing
(Sensor Databases, SensorDBs)
σ,π,α
Scheduler
Networking
SELECT temperature
FROM sensors
WHERE temperature > 900
SELECT avg (light)
FROM sensors
SAMPLE INTERVAL 60s
sink
SAMPLE INTERVAL 60s
Avg light:
(1000+500)/2
σ,π,α
Scheduler
Sensing &
Networking
Avg
light:
300/1
light: 500
σ,π,α
Scheduler
Sensing &
Networking
light: 300
SIGMOD07 Tutorial
Avg
light:
1000/1
σ,π,α
Scheduler
Sensing &
Networking
light: 1000
SensorDB System Design Issues
3
Two Representative SensorDBs

Cougar [BGS01, YG03]




Model sensor network data as sequences
Declarative query interface with UDFs
Cross-layer optimization in later versions
TinyDB [MF+02, 03]



Declarative query interface
Efficient and extensible framework
Open-source implementation on real nodes
SIGMOD07 Tutorial
SensorDB System Design Issues
4
Advantages of Sensor Databases

Flexibility



Declarative SQL style queries
Dynamic query injection and removal
Efficiency

Cross-layer optimization

E.g., in-network filtering and aggregation
SIGMOD07 Tutorial
SensorDB System Design Issues
5
Challenges in Sensor Databases


Dynamic data streams
Hardware resource limitations




Limited per-node computing power and storage
Unreliable wireless communication
Battery power supply
Complex, networked, embedded software


Blurred boundaries between components
Plenty of cross-layer optimization opportunities
SIGMOD07 Tutorial
SensorDB System Design Issues
6
Focus of this Tutorial

System design issues in sensor databases





Software architecture
Operating system support
Media Access Control (MAC)
Routing
Scheduling
These issues often dominate the overall performance.
SIGMOD07 Tutorial
SensorDB System Design Issues
7
Outline


Introduction
WSN hardware







Computing, sensing, communication, and power supply
Software architecture
Operating system support
MAC protocols
Routing
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
8
Current Sensor Node Hardware:
Computing and Storage

Low-power microcontroller (CPU of a node)


E.g., Atmega128 (MICA series), MSP430
(Telos series), ARM/THUMB (XYZ sensor),
and the latest 180MHz ARM920 (SunSpot).
Limited memory

RAM


≤ 10KB SRAM (Static RAM)
ROM

Usually ≤ 1MB flash memory
SIGMOD07 Tutorial
SensorDB System Design Issues
9
Current Sensor Node Hardware:
Sensing and Radio

Sensing devices


Electronic, mechanic, bio-chemical, …
Radio transceiver




Fixed radio frequency
Omni-direction radio signal
Transmission rate ≤ 200 kbps
Transmission range ≤ 50 meters
SIGMOD07 Tutorial
SensorDB System Design Issues
10
Current Sensor Node Hardware:
Power Supply and Consumption

Power supply


Batteries, usually <= 2000 mAh
Electric currents in a node


Sleep 15-20 µA
Radio on


Idle 20-25 mA, compute 25-30 mA
Radio off

Idle 1-5 mA, compute 5-10 mA
Sleeping is the most effective means to save energy.
SIGMOD07 Tutorial
SensorDB System Design Issues
11
Outline








Introduction
WSN hardware
Software architecture
Operating system support
MAC protocols
Routing
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
12
Common Software Architecture of
Sensor Databases
Query Layer
Selection
Projection
Join
Aggregation
Topology Maintenance
Data Transmission
Query Dissemination
MAC Layer
Energy Conservation
Bandwidth Allocation
Scheduling
Routing Layer
Time Synchronization
Operating System Kernel
Boundaries between components in a sensorDB are blurred.
SIGMOD07 Tutorial
SensorDB System Design Issues
13
Outline




Introduction
WSN hardware
Common SensorDB software architecture
Operating system support






Hardware management
Application code development and deployment
MAC protocols
Routing
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
14
TinyOS (http://www.tinyos.net/)

De facto OS for sensor nodes




Early research effort
Open source development
Wide presence in commercial products
Component-based architecture



Adaptive to hardware changes
Lightweight for various applications
Event-driven processing

Responsive to sensor signals and radio messages
SIGMOD07 Tutorial
SensorDB System Design Issues
15
TinyOS Application
TinyOS startup (“Main”)
Runable image of a
TinyOS application
Application
Commands
Lib components
Kernel:
TinyOS interface components
Core system components
Hardware manipulation components
Abstraction:
Hardware:
Events
Mote main board
Sensor devices
A TinyOS application is compiled with TinyOS components.
SIGMOD07 Tutorial
SensorDB System Design Issues
16
Some Limitations of TinyOS

Static code and memory





No virtual memory
No dynamic memory allocation
No dynamic code update
Task execution without priorities
TinyOS memory
allocation
Stack
Free
Global
Single thread
SIGMOD07 Tutorial
SensorDB System Design Issues
17
Contiki [DGV04]



Multi-threading
Lightweight program
loading
Lightweight
communication stacks

core
#2
#3
uIP


#1
A micro-version of RFCcompliant TCP/IP
Rime

A lightweight
communication stack for
low-power radio
SIGMOD07 Tutorial
#n
…
Multi-threading in Contiki
SensorDB System Design Issues
18
SOS [HK+05]

Dynamic module
loading


Jump table
System function call
Allows incremental
update of binary code
Module #1
Module #2

…
Runtime safety
mechanisms

Memory monitoring
Watchdog

Restart when system
hangs
SIGMOD07 Tutorial
1
2
Module #N
SOS Kernel
Actual function to call
SensorDB System Design Issues
19
MANTIS [BC+05]
User threads




Multi-threading
Remote testing
Scheduler for dutycycle sleeping
Small code size

Uses less than 500B
RAM and 14KB flash
memory
SIGMOD07 Tutorial
Network
Stack
Command
Server
#1 … #n
MANTIS System API
Kernel /
Scheduler
Communication Device
Layer
driver
Sensor Node Hardware
SensorDB System Design Issues
20
t-kernel [GS06]



Load
Extends the limited SRAM
Preemptive scheduling


Separates OS/app space
Virtual memory


Application binary code
OS protection
Naturalization
Allows priorities
Fault tolerance

Prevents system hang-up
from application errors
Run
Running an app. in t-kernel
SIGMOD07 Tutorial
SensorDB System Design Issues
21
On-Node Virtual Machines

SunSPOT



http://www.sunspotworld.com/
A compact Java
language
Java VM directly runs in
on-node flash memory
SwissQM [MAK07]

Combines a powerful
gateway with a virtual
machine at the sensors

Query
synopsis
QM
programs
Query Machine (QM)
SIGMOD07 Tutorial
SensorDB System Design Issues
Transmission
buffer
Bytecode
interpreter
Operand
stack
Sensors
22
Declarative Sensor Networks [CP+07]

Snlog language




Snlog compiler


Datalog-like, declarative
Suitable for polynomial-time
programs
Useful in a variety of apps

Translate Snlog into NesC
Components of user provided
rules
No on-node interpreter
SIGMOD07 Tutorial
Snlog program
Snlog front-end
Execution planner
nesC Templates
NesC backend
Runtime system

Snlog compiler
DSN runtime
components
Binary code
to be executed
SensorDB System Design Issues
Generated
NesC program
NesC Compiler
23
Summary on OS Support

Support app. development and deployment




Programming interfaces
Code compilation and generation
Runtime loading and modification
Provide hardware resource management



Sensor signals, radio messages
Memory allocation and virtualization
Scheduling and system safety
SIGMOD07 Tutorial
SensorDB System Design Issues
24
OS and Sensor Databases

Desirable OS features for sensor databases





Multiple applications
Multi-threading
Virtual memory
Priority scheduling
Reliability and fault tolerance
SIGMOD07 Tutorial
SensorDB System Design Issues
25
Outline





Introduction
WSN hardware
Common SensorDB software architecture
Operating system support
MAC protocols




CSMA, STEM, S-MAC, and T-MAC
Routing
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
26
CSMA (Carrier Sense Multiple Access)



Random delay before transmission attempt
Node needs to keep idle listening before its
communication done
Wireless collision remains a major problem

Reason: no effective coordination between
nodes
transmitting
Collision
Sender 1
transmitting
Sender 2
SIGMOD07 Tutorial
SensorDB System Design Issues
27
Sparse Topology and Energy
Management (STEM) [STS02]


Periodic wake up and listen
Sleep when no packet to send and receive
Power
Transmit
Listening
Listening
Listening
Sleep
time
SIGMOD07 Tutorial
SensorDB System Design Issues
28
S-MAC (Sensor-MAC) [YHE02]


Schedules nodes to periodically sleep
Coordinates the sleeping time of neighbors
for reliable transmission
Listen
Receiver
Sleep
SYNC
RTS
Sender
SIGMOD07 Tutorial
SensorDB System Design Issues
29
T-MAC [DL03]


Contention based protocol
Dynamically ends an active period

Adapts to the needs for computation and
communication
S-MAC
Active time
Sleep time
Active time
Sleep time
T-MAC
TA
SIGMOD07 Tutorial
Aha, no more to do!,
zzz~
SensorDB System Design Issues
30
Summary on MAC

Important for performance

Communication quality



Communication energy



Signal errors
Noise
Sleeping nodes
Retransmission
Communication delay


Negotiation for channels
Wireless signal transmission delay
Significant to data quality, energy efficiency and
response time in query processing!
SIGMOD07 Tutorial
SensorDB System Design Issues
31
MAC and Sensor Databases

MAC behavior of sensor databases



Mostly converge-cast
Periodic data flows
Opportunities of sensor databases for MAC

Sleep scheduling that suits the data flows
SIGMOD07 Tutorial
SensorDB System Design Issues
32
Outline






Introduction
WSN hardware
Common SensorDB software architecture
Operating system support
MAC protocols
Routing



MintRoute, TinyAODV, and Directed Diffusion
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
33
Location-Based Routing

Requires location information

Usually finds the shortest, reliable path using
location information of each node


Energy aware
Suitable for queries with spatial predicates

Can route queries to some specific regions
D
Transmission range of S
SIGMOD07 Tutorial
S
SensorDB System Design Issues
Shortest path
34
Flooding

Every node broadcasts received data


Advantage


Broadcast can be reduced by hop count
Simple
Problems

Message implosion


Many duplicates
Resource inefficiency


Most nodes busy
No sleeping
SIGMOD07 Tutorial
SensorDB System Design Issues
35
Directed Diffusion [IG+00]




Queries are defined as interests.
Sink nodes post interests.
Source nodes generate sensory data.
Source nodes select reliable and efficient
routes to the sink nodes to forward data.
SIGMOD07 Tutorial
SensorDB System Design Issues
36
Illustration of Directed Diffusion
Step 1:
Sink node
propagates
Interest (query)
Sink
node
Step 2:
Set up gradients
Source node
Step 3: Reinforce one
path
Sink
node
Source node
Sink
node
Source node
SIGMOD07 Tutorial
SensorDB System Design Issues
37
MintRoute [WTC03]

Implemented in TinyOS


Can be used in TinyDB
More than simple shortest-path routing


Monitors link connectivity
Decides a route based on both link quality and
distance
Unreliable, high loss rate
1
1
2
3
SIGMOD07 Tutorial
2
3
SensorDB System Design Issues
38
TinyAODV (Tiny Ad-hoc OnDemand Distance Vector)


Builds paths only when needed
Uses sequence number in RREQ to avoid
cycles
Source
Destination
…
RREQ: Route Request
RREQ
RREP: Route Reply
RREP
RERR: Route ERR
DATA
…
X
RERR
SIGMOD07 Tutorial
SensorDB System Design Issues
39
Summary on Routing

Focus of current routing protocols

Efficient forwarding


Load balancing


Shortest path or least retransmission
Avoid hot spots of heavy traffic
Open issues

Reliability



Node failure
Noise
Communication delay

Find the path of the minimal delay
SIGMOD07 Tutorial
SensorDB System Design Issues
40
Routing and Sensor Databases

Routing characteristics of sensor databases



Mainly converge-casting
Not all nodes satisfy a query all the time.
Opportunities of sensorDBs for routing

Data flow aware routing



Busy nodes get better routes.
Busy queries get better routes.
Query type aware routing

Aggregation, duplicate-sensitivity, join
SIGMOD07 Tutorial
SensorDB System Design Issues
41
Outline







Introduction
WSN hardware
Common SensorDB software architecture
Operating system support
MAC protocols
Routing
Scheduling


FPS, Sichitiu’s Scheme, and DCS
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
42
Goal of Scheduling

Communication efficiency and reliability

Coordinate nodes in communication


Wireless collisions among neighbors
No receiving on sleeping nodes
Sending…
zzz…
Done!
Lost!
SIGMOD07 Tutorial
SensorDB System Design Issues
zzz…
43
Centralized Scheduling

The base station specifies schedules for all
nodes.



The base station must be aware of the workload
and the network topology
Hard to scale
Hard to adapt to changes
SIGMOD07 Tutorial
SensorDB System Design Issues
Sink
…
Schedule
44
Distributed Scheduling

Scheduling in TinyDB (query layer)


A node keeps active for 4 seconds and sleeps in the
remaining time in a sample interval.
Sichitiu’s Scheduling Scheme [Sic04]
 Schedules at the MAC and routing layers
 Sets up both routing paths and schedules

Schedule construction is time consuming and
unreliable because it needs the sink to confirm.
SIGMOD07 Tutorial
SensorDB System Design Issues
45
FPS (Flexible Power Scheduling)
[HDB04]



Routing-layer distributed scheduling
A parent node assigns transmission slots to
its children to avoid collision between
siblings.
Collisions among non-sibling neighbors are
possible.
Slots:
sleep
sleep
compute transmit …
Time
SIGMOD07 Tutorial
SensorDB System Design Issues
46
DCS (Distributed Cross-Layer
Scheduling) [WLX06]


Slot based
Takes query processing cycles into account


Receiving, computing, transmission, and sleep
Not only parents assign schedules to children, but
neighbors also negotiate.


Able to avoid the collisions at the receiving nodes
Attempts to assign consecutive transmission slots to
each node
SIGMOD07 Tutorial
SensorDB System Design Issues
47
DCS Components
Scheduling Module
Query Scheduling
Query Layer
Selection / Projection / Join / Aggregation
Schedule Execution
Routing Layer
Schedule Construction
Route Selection
Route Maintenance
MAC Layer
Time Synchronization
SIGMOD07 Tutorial
Collision Detection
SensorDB System Design Issues
Transmission /
Receiving
48
Slot in a Schedule

A slot is a time period of fixed length.


Transmission, Sleeping, PL/R (Processing,
Listening / Receiving), and Q/M (Query
injection / route Maintenance)
t  t0 

Slot number s at t: s 
mod
m
 ls 
 The length of a slot is ls.


The schedule start time is t0.
A sample interval has m slots.
SIGMOD07 Tutorial
SensorDB System Design Issues
49
An Example Schedule
Routing
tree
0
Active (sink only)
Q/M
Sleeping
PL/R
Transmission
3
2
Sink
Hop 0
Hop 1
Node3
Hop 2
Node2
Hop 2
Node 1
0
SIGMOD07 Tutorial
Leaf Leaf
1
Time
SensorDB System Design Issues
50
Energy Efficiency
Measured in VMNet
Original TinyDB
Measured in the 10-Node Real WSN
Optimized TinyDB
Original TinyDB
Optimized TinyDB
5
Power Consumption (Joules) .
Power Consumption (Joules) .
5
4.5
4
3.5
3
2.5
2
1.5
1
0.5
4.5
4
3.5
3
2.5
2
1.5
1
0.5
0
0
2
10
Sample Interval (s)
60
2
10
Sample Interval (s)
60
DCS achieves 50-60% energy saving.
SIGMOD07 Tutorial
SensorDB System Design Issues
51
Summary on Scheduling


Scheduling is done on one or more layers.
Scheduling is crucial for performance.

Communication reliability


Energy consumption


Coordination of nodes
Sleep scheduling
Response time

Different transmission timings of neighboring nodes
result in different delays.
SIGMOD07 Tutorial
SensorDB System Design Issues
52
Scheduling and Sensor Databases


SensorDBs are complex to schedule.
Opportunities in scheduling for sensorDBs

On-node multi-query scheduling




Limited resources
Changing sensor environments
Query-aware transmission scheduling
Interaction between scheduling and query
execution
SIGMOD07 Tutorial
SensorDB System Design Issues
53
Outline








Introduction
WSN hardware
Common SensorDB software architecture
Operating system support
MAC protocols
Routing
Scheduling
Summary and future directions
SIGMOD07 Tutorial
SensorDB System Design Issues
54
Tutorial Summary



System design issues have a significant
impact on the overall performance of sensor
databases.
A holistic sensor database system requires
considerations on all layers – from OS
kernel, MAC, routing to query processing.
Cross-layer design is necessary, especially
in scheduling.
SIGMOD07 Tutorial
SensorDB System Design Issues
55
Future Directions

Multi-query processing in sensor networks

Query optimization


Scheduling


Queries, operators, and transmission
In-network joins among different nodes


Sharing, caching, and pipelining
Fine-grained scheduling for node cooperation
Query processing in multi-sink networks
Cross-layer design is necessary for an efficient, holistic sensor database.
SIGMOD07 Tutorial
SensorDB System Design Issues
56
References: Sensor Databases and
Runtime Support
[BGS01] Philippe Bonnet, Johannes Gehrke, and Praveen Seshadri. Towards
Sensor Database Systems. MDM, 2001 .
[MF+02] Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei
Hong. TAG: a Tiny AGgregation Service for Ad-Hoc Sensor Networks.
OSDI, 2002.
[MF+03] Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei
Hong. The Design of an Acquisitional Query Processor for Sensor
Networks. SIGMOD, 2003.
[YG03] Yong Yao and Johannes Gehrke. Query Processing for Sensor Networks.
CIDR, 2003.
[MAK07] Rene Muller, Gustavo Alonso, and Donald Kossman. SwissQM: Next
Generation Data Processing in Sensor Networks. CIDR, 2007.
[CP+07] David Chu, Lucian Popa, Arsalan Tavakoli, Joseph M. Hellerstein,
Philip Levis, Scott Shenker, and Ion Stoica. The Design and Implementation
of A Declarative Sensor Network System. Submitted for publication, 2007.
SIGMOD07 Tutorial
SensorDB System Design Issues
57
References: OS Support
[DGV04] Adam Dunkels, Björn Grönvall, and Thiemo Voigt. Contiki - A
Lightweight and Flexible Operating System for Tiny Networked
Sensors. The 29th Annual IEEE Conference on Local Computer Networks,
2004.
[HK+05] Chih-Chieh Han, Ram Kumar, Roy Shea, Eddie Kohler and Mani
Srivastava. A Dynamic Operating System for Sensor Nodes.
International Conference on Mobile Systems, Applications, and Services,
2005.
[BC+05] Shah Bhatti, James Carlson, Hui Dai, Jing Deng, Jeff Rose, Anmol
Sheth, Brian Shucker, Charles Gruenwald, Adam Torgerson, and Richard
Han. MANTIS OS: An Embedded Multithreaded Operating System
For Wireless Micro Sensor Platforms. ACM/Kluwer Mobile Networks
and Applications (MONET), Special Issue on Wireless Sensor Networks,
vol. 10, no. 4, pp.563–579, Aug 2005.
[GS06] Lin Gu and John A. Stankovic. t-kernel: Providing Reliable OS
Support for Wireless Sensor Networks. SenSys, 2006.
SIGMOD07 Tutorial
SensorDB System Design Issues
58
References: MAC and Routing
[STS02] Curt Schurgers, Vlasios Tsiatsis, and Mani B. Srivastava. STEM:
Topology Management for Energy Efficient Sensor Networks.
IEEE Aerospace Conference, 2002.
[YHE02] Wei Ye, John Heidemann, and Deborah Estrin. An EnergyEfficient MAC Protocol for Wireless Sensor Networks. INFOCOM,
2002.
[DL03] Tijs van Dam and Koen Langendoen. An Adaptive EnergyEfficient MAC Protocol for Wireless Sensor Networks. SenSys,
2003.
[IGE00] Chalermek Intanagonwiwat, Ramesh Govindan, and Deborah
Estrin. Directed Diffusion: A Scalable and Robust Communication
Paradigm for Sensor Networks. MobiCom, 2000.
[WTC03] Alec Woo, Ternence Tony, and David Culler. Taming the
Underlying Challenges of Reliable Multihop Routing in Sensor
Networks. SenSys, 2003.
SIGMOD07 Tutorial
SensorDB System Design Issues
59
References: Scheduling
[HDB04] Barbara Hohlt, Lance Doherty, and Eric Brewer. Flexible
Power Scheduling for Sensor Networks. IPSN, 2004.
[Sic04] Mihail L. Sichitiu. Cross-Layer Scheduling for Power
Efficiency in Wireless Sensor Networks. INFOCOM, 2004.
[WLX06] Hejun Wu, Qiong Luo, and Wenwei Xue. Distributed CrossLayer Scheduling for In-Network Sensor Query Processing.
PerCom, 2006.
SIGMOD07 Tutorial
SensorDB System Design Issues
60