Nano-RK: an Energy-aware Resource-centric RTOS for Sensor Networks - - PowerPoint PPT Presentation

nano rk
SMART_READER_LITE
LIVE PREVIEW

Nano-RK: an Energy-aware Resource-centric RTOS for Sensor Networks - - PowerPoint PPT Presentation

Nano-RK: an Energy-aware Resource-centric RTOS for Sensor Networks Anand Eswaran Anthony Rowe Raj Rajkumar Anand Eswaran, Anthony Rowe, Raj Rajkumar { aeswaran,agr,raj} @ece.cmu.edu Real-Time and Multimedia Systems Lab Carnegie Mellon


slide-1
SLIDE 1

Nano-RK:

an Energy-aware Resource-centric RTOS for Sensor Networks

Anand Eswaran Anthony Rowe Raj Rajkumar Anand Eswaran, Anthony Rowe, Raj Rajkumar { aeswaran,agr,raj} @ece.cmu.edu Real-Time and Multimedia Systems Lab Carnegie Mellon University

Presented by Anthony Rowe RTSS 2005 Real-Time and Multimedia Systems Laboratory

slide-2
SLIDE 2

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 safety health and safety,

  • Report malfunctions (nearly) instantly, and
  • Support mobile nodes and track people.

Real-Time and Multimedia Systems Laboratory

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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

slide-5
SLIDE 5

NanoRK Motivation

  • Quicker Development Cycles

p 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 tasks Local 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 communication Reservations 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

slide-6
SLIDE 6

NanoRK Motivation

  • Why Priority-based scheduling?

Period Execution Time Period Execution Time

Network 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 g daunting… Furthermore, what if a new sensor is added or a

Real-Time and Multimedia Systems Laboratory

period changes?

slide-7
SLIDE 7

Goals of a Sensor RTOS (1 of 2) ( )

  • Multitasking with Priority-Based

Multitasking with Priority Based Preemption

– Respond on a timely basis to critical events p y – Support predictability and schedulability

  • Built-in Network Support

u 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

slide-8
SLIDE 8

Goals of a Sensor RTOS (2 of 2) ( )

  • Unified Sensor / Network API

Unified 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

slide-9
SLIDE 9

FireFly Hardware y

Atmega128L CC2420 (802.15.4) Light, Temp, Audio, PIR, Acceleration, PIR, Acceleration, Ultrasound Global AM band Synchronization Synchronization

Real-Time and Multimedia Systems Laboratory

slide-10
SLIDE 10

FireFly Synchronization Hardware y y

Real-Time and Multimedia Systems Laboratory

slide-11
SLIDE 11

NanoRK Resources

Component Resource

Context Swap Time 45 μS Context Swap Time 45 μS Mutex Structure Overhead 5 Bytes per Resource Stack Size Per Task 32128 bytes (64 bytes by default) y ( y y ) OS Struct Overhead 50 bytes Per Task Network 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

slide-12
SLIDE 12

NanoRK Reservations

  • CPU

CPU

– 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

slide-13
SLIDE 13

Virtual Energy Reservations gy

  • {CPU, Network, Sensors}

– Together comprise the total energy usage of the node

  • Static Offline Budget Enforcement

It 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/ Reserve a [1,2] 1 8 years 8 years

e G

b 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

d b Real-Time and Multimedia Systems Laboratory

d [1,2] 1 3.9 days 5 years e [1,2] 1 4 days 2.9 years

slide-14
SLIDE 14

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

slide-15
SLIDE 15

NanoRK Architecture

User Applications

S

Real-Time Scheduler IPC

Task Management Sensor Drivers

Network Stack E R ti Energy Reservations

Kernel

Microcontroller 802.15.4 Radio

Real-Time and Multimedia Systems Laboratory

Hardware

slide-16
SLIDE 16

NanoRK Architecture

Real Time Scheduler

User Applications

Real-Time Scheduler

  • Priority-based Scheduling
  • Static Design-time

Real-Time Scheduler IPC

  • Static Design-time

Framework

  • Priority Ceiling Protocol

Task Management Sensor Drivers

Network Stack Energy Reservations

Kernel

Microcontroller 802.15.4 Radio

Real-Time and Multimedia Systems Laboratory

Hardware

slide-17
SLIDE 17

NanoRK Architecture

T k M t

User Applications

  • Task Management

– Two 32 bit counters

  • { Seconds, Nanoseconds }

Task Sensor

Real-Time Scheduler IPC

{ , }

– Periodic Task Switching

  • Triggered by a One Shot Timer
  • r an Event

Task Management Sensor Drivers

Network Stack Energy Reservations – Enables Fine Grained Timing Control Energy Reservations

Kernel

Microcontroller 802.15.4 Radio

H d

Real-Time and Multimedia Systems Laboratory

Hardware

slide-18
SLIDE 18

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; // ms Task1.set_reserve[CPU] = 50; //ms Task1.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

slide-19
SLIDE 19

NanoRK Architecture

S D i

User 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 Stack Energy Reservations

  • Temp = 67

– Real World Values

  • Temp = 24 (°C)

Energy Reservations

Kernel

p ( )

Microcontroller 802.15.4 Radio

H d

Real-Time and Multimedia Systems Laboratory

Hardware

slide-20
SLIDE 20

NanoRK Architecture

I t P

User 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 Stack Energy Reservations – “Message Boxes” Energy Reservations

Kernel

Microcontroller 802.15.4 Radio

H d

Real-Time and Multimedia Systems Laboratory

Hardware

slide-21
SLIDE 21

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

Network Stack – 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

slide-22
SLIDE 22

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 Support

Network 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

slide-23
SLIDE 23

Detailed NanoRK Network Stack

U A li ti Network Task User Application

TX B ff sock_fd

*

Network Task …

*

TX Buffer

Config

k fd

*

… NanoRK Kernel Receiver Interrupt

RX Buffer sock_fd

*

Config

Router MAC Forwarding Buffers Kernel

Routing Table

Radio Interface Real-Time and Multimedia Systems Laboratory Radio Interface

slide-24
SLIDE 24

NanoRK Limitations

  • No User / Kernel Space

p Boundary

– Single Memory Space with no MMU Single Memory Space with no MMU

  • Somewhat higher memory
  • verhead
  • verhead

– Compared to non-multitasking operating systems systems

Real-Time and Multimedia Systems Laboratory

slide-25
SLIDE 25

Simulation / Modeling Tool

  • Represent Network

as a Graph

– Easily evaluate different Easily evaluate different scheduling algorithms

  • Cycle-Accurate

Power and Channel Power and Channel Modeling

– Analyze how different schedules effect power schedules effect power, throughput, and latency

  • Hybrid simulator

f – Allow virtual expansion of

  • ur real network

– Works with real nodes Real-Time and Multimedia Systems Laboratory

slide-26
SLIDE 26

Future Work

  • A public domain release
  • Dynamic upgrades
  • Support for multiple microcontrollers

Support 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

slide-27
SLIDE 27

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

slide-28
SLIDE 28

Questions?

Real-Time and Multimedia Systems Laboratory