Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Nano-RK:an Energy-aware Resource-centric RTOS for Sensor Networks
Anand Eswaran Anthony Rowe Raj RajkumarAnand Eswaran, Anthony Rowe, Raj Rajkumar{aeswaran,agr,raj}@ece.cmu.edu
Real-Time and Multimedia Systems LabCarnegie Mellon University
Presented by Anthony RoweRTSS 2005
Real-Time and Multimedia Systems Laboratory
Secure Sensor Networks for Ph i l I f t t
• Develop a secure software platform for
Physical Infrastructures
infrastructure sensor networks to be deployed in physical structures such as factories, buildings, homes, bridges,factories, buildings, homes, bridges, campuses, vehicles, ships and planes.
• Provide continual monitoring of operational health and safetyhealth and safety,
• Report malfunctions (nearly) instantly, and• Support mobile nodes and track people.
Real-Time and Multimedia Systems Laboratory
What is nanoRK?• A Real-time Operating System for sensor
nodes for use in wireless sensor networks– Priority-Based Preemptive Multitasking– Resource Reservations– Built-in Multi-hop Networking Support
Real-Time and Multimedia Systems Laboratory
Related Work
• Tiny OS (Berkeley)L bli f ll i d t– Large public following and support
– Compact– Cooperative Multitasking– No timing guarantees for tasks
• Mantis OS (University of Colorado)No real time scheduling– No real-time scheduling
– No reservation support• uCos, Emerald, OSEK
– Still too large– Not network centric
Real-Time and Multimedia Systems Laboratory
NanoRK Motivation
• Quicker Development Cyclesp y– Traditional OS abstractions allow for quicker learning curves
and help abstract away low level details
• Scaling Technology• Scaling Technology– Sensor Nodes will become increasingly complex as they
begin to manage multiple tasksLocal Processing is much cheaper than using the network– Local Processing is much cheaper than using the network
• Resource Reservations (Energy Budget)– Reservations can enforce energy and communicationReservations can enforce energy and communication
budgets to minimize negative impact on network lifetimes from unintentional errors or malicious behavior on some nodes
Real-Time and Multimedia Systems Laboratory
NanoRK Motivation• Why Priority-based scheduling?
Period Execution TimePeriod Execution TimeNetwork Radio Sporadic 10ms
Audio Sensor 200 hz 10us
Light Sensor 166 hz 10us
Smart Camera 1 hz 300ms
Global Positioning 5 hz 10ms
Time-triggered task interleaving can become gg gdaunting…
Furthermore, what if a new sensor is added or a
Real-Time and Multimedia Systems Laboratory
period changes?
Goals of a Sensor RTOS (1 of 2)( )
• Multitasking with Priority-BasedMultitasking with Priority Based Preemption– Respond on a timely basis to critical eventsp y– Support predictability and schedulability
• Built-in Network Supportu t et o Suppo t– Decrease coding effort to implement custom
communication protocols
• Enforce Energy Usage Limits– Meet Battery Lifetime Requirements
Real-Time and Multimedia Systems Laboratory
Goals of a Sensor RTOS (2 of 2)( )
• Unified Sensor / Network APIUnified Sensor / Network API– Sensors and actuators support in a device
driver manner that is abstracted away from the user
• Small Footprint– Current trends in microcontrollers show larger
ROM sizes (64Kb to 128KB) and smaller RAM sizes (2KB to 8KB)sizes (2KB to 8KB)
Real-Time and Multimedia Systems Laboratory
FireFly Hardwarey
Atmega128L
CC2420 (802.15.4)
Light, Temp, Audio, PIR, Acceleration,PIR, Acceleration, Ultrasound
Global AM band SynchronizationSynchronization
Real-Time and Multimedia Systems Laboratory
FireFly Synchronization Hardwarey y
Real-Time and Multimedia Systems Laboratory
NanoRK ResourcesComponent Resource
Context Swap Time 45 μSContext Swap Time 45 μSMutex Structure Overhead 5 Bytes per Resource
Stack Size Per Task 32 128 bytes (64 bytes by default)y ( y y )
OS Struct Overhead 50 bytes Per TaskNetwork Overhead 164 bytes
Total Typical Configuration:(8 tasks, 8 mutexes, 4 16 byte
network buffers)
2KB RAM, 10KB ROM
Current Hardware Platform: 4Mhz Atmega128L with Chipcon CC2420 802.15.4 transceiver
Real-Time and Multimedia Systems Laboratory
NanoRK Reservations
• CPUCPU– Each Task can be given a budget of how long
it is allowed to execute per a given period
• Network– Per Task Budget on Network Usage– Transmit and Receive Packets and/or Bytes
• Sensors / Actuators– Number of System Calls to a particular
peripheral per a given period
Real-Time and Multimedia Systems Laboratory
Virtual Energy Reservationsgy
• {CPU, Network, Sensors}– Together comprise the total energy usage of the node
• Static Offline Budget EnforcementIt is possible to calculate a node lifetime given a certain– It is possible to calculate a node lifetime given a certain energy budget
Node Reserve TX Rate Lifetime Lifetime
a c
e G
Node Reserve[ TX, RX ]
TX Rate Lifetime w/ out
Reserve
Lifetime w/
Reservea [1,2] 1 8 years 8 years
e Gb X 300 3.5 days 3.5 days
c [1,2] 1 5 years 5 years
d [1 2] 1 3 9 days 5 years
db
Real-Time and Multimedia Systems Laboratory
d [1,2] 1 3.9 days 5 years
e [1,2] 1 4 days 2.9 years
NanoRK Reservations
• What if a reservation is violated?What if a reservation is violated?• Hard Reservation
– For CPU reservations the task is preempted– For CPU reservations, the task is preempted– For Sensor/Network reservations, an error is
returned to the task making the system call
• Firm Reservations– The task is allowed to consume slack
resources until they have been depleted
Real-Time and Multimedia Systems Laboratory
NanoRK ArchitectureUser Applications
S
Real-Time Scheduler IPC
Task Management
Sensor Drivers Network
StackE R tiEnergy Reservations
Kernel
Microcontroller 802.15.4 Radio
Real-Time and Multimedia Systems Laboratory
Hardware
NanoRK Architecture
Real Time Scheduler User ApplicationsReal-Time Scheduler• Priority-based Scheduling• Static Design-time
Real-Time Scheduler IPC• Static Design-time
Framework• Priority Ceiling Protocol
Task Management
Sensor Drivers Network
StackEnergy Reservations
Kernel
Microcontroller 802.15.4 Radio
Real-Time and Multimedia Systems Laboratory
Hardware
NanoRK Architecture
T k M tUser Applications
• Task Management– Two 32 bit counters
• { Seconds, Nanoseconds } Task Sensor
Real-Time Scheduler IPC
{ , }– Periodic Task Switching
• Triggered by a One Shot Timer or an Event
Task Management
Sensor Drivers Network
StackEnergy Reservations
– Enables Fine Grained Timing Control
Energy Reservations
Kernel
Microcontroller 802.15.4 Radio
H dReal-Time and Multimedia Systems Laboratory
Hardware
Nano-RK Task Specs
nrk_task_type Task1;
Task1.task = Sound_Task;Task1.Ptos = (void *) &Stack1[STACKSIZE - 1];Task1.TaskID = 1;Task1.priority = 3;Task1.Period = 1000; // msTask1.set_reserve[CPU] = 50; //msTask1.set_reserve[NETWORK_PACKETS] = 3;Task1 set reserve[SENSE ACTUATE] = 12;Task1.set_reserve[SENSE_ACTUATE] = 12; nrk_activate_task(Task1);
Real-Time and Multimedia Systems Laboratory
NanoRK Architecture
S D iUser Applications
• Sensor Drivers– System Calls
• Allows for arbitration if two Task Sensor
Real-Time Scheduler IPC
tasks read from a non-atomic sensor
– Raw ADC Values
Task Management
Sensor Drivers Network
StackEnergy Reservations
• Temp = 67– Real World Values
• Temp = 24 (°C)
Energy Reservations
Kernelp ( )
Microcontroller 802.15.4 Radio
H dReal-Time and Multimedia Systems Laboratory
Hardware
NanoRK Architecture
I t PUser Applications
• Inter Process Communication
U S h t bit t Task Sensor
Real-Time Scheduler IPC
– Use Semaphores to arbitrate shared memory communication“M B ”
Task Management
Sensor Drivers Network
StackEnergy Reservations– “Message Boxes” Energy Reservations
Kernel
Microcontroller 802.15.4 Radio
H dReal-Time and Multimedia Systems Laboratory
Hardware
NanoRK Network Stack
• Zerocopy Buffering Mechanism• Zerocopy Buffering Mechanism– TX and RX buffers are in application space– Kernel Manages network data through pointer
manipulation into application space
• Port Abstraction NetworkStack
– A port allows applications to direct their data to individual tasks on each node
• Network Task• Network Task– Handles Forwarding Packets, Routing, etc.
Real-Time and Multimedia Systems Laboratory
NanoRK Network Stack
• CSMA MAC Support• CSMA MAC Support– Low Power Listen (LPL) MAC support
• TDMA MAC Support• TDMA MAC Support– RT-Link: Globally Time Synchronized MAC protocol
• Ad-Hoc Routing SupportNetwork
Stack• Ad-Hoc Routing Support– Tasks can access low level routing table– Ex: An AODV or DSR TASK can be responsible for
establishing and managing routes
Real-Time and Multimedia Systems Laboratory
Detailed NanoRK Network Stack
U A li ti Network TaskUser Application
TX B ff
sock_fd
*
Network Task
…*
TX Buffer
Config
k fd
*… NanoRKKernel
Receiver Interrupt
RX Buffer
sock_fd
*
Config Router MAC
Forwarding BuffersKernel
Routing Table
Radio Interface
Real-Time and Multimedia Systems Laboratory
Radio Interface
NanoRK Limitations
• No User / Kernel Space pBoundary– Single Memory Space with no MMUSingle Memory Space with no MMU
• Somewhat higher memory overheadoverhead– Compared to non-multitasking operating
systemssystems
Real-Time and Multimedia Systems Laboratory
Simulation / Modeling Tool• Represent Network
as a Graph– Easily evaluate differentEasily evaluate different
scheduling algorithms
• Cycle-Accurate Power and ChannelPower and Channel Modeling– Analyze how different
schedules effect powerschedules effect power, throughput, and latency
• Hybrid simulatorf– Allow virtual expansion of
our real network– Works with real nodes
Real-Time and Multimedia Systems Laboratory
Future Work
• A public domain release• Dynamic upgrades• Support for multiple microcontrollersSupport for multiple microcontrollers• Family of applications
C l t t f t l• Complete set of tools• Field deployment
Real-Time and Multimedia Systems Laboratory
Conclusions
• NanoRK: a sensor network Operating System– priority-based preemptive multitasking– task synchronization– multi-hop communications support
• Reservations can enforce system-wide energy and communication usage
• Easy-to-use high level Networking and Sensor Abstractions
Real-Time and Multimedia Systems Laboratory
Questions?
Real-Time and Multimedia Systems Laboratory