Operating Systems for Network of Sensors - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Operating Systems for Network of Sensors

Description:

Javac: compile java source into java bytecode. Avr-gcc: compile C source into avr instructions ... Cross-compile. Upload binary. Testing. 10/6/04. 3 ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 17
Provided by: david3087
Category:

less

Transcript and Presenter's Notes

Title: Operating Systems for Network of Sensors


1
Operating Systems for Network of Sensors
  • Simon Han
  • simonhan_at_ee.ucla.edu

2
Embedded Software Development
  • Cross-compiler
  • A compiler which runs on one platform and
    produces code for another.
  • Javac compile java source into java bytecode
  • Avr-gcc compile C source into avr instructions
  • Tool-chain
  • Compiler binutils (linker, assembler)
    libraries.
  • Development cycle
  • Coding
  • Cross-compile
  • Upload binary
  • Testing

3
Characteristics of Network Sensors
  • Small physical size and low power consumption
  • Concurrency-intensive operation
  • multiple flows, not wait-command-respond
  • Limited Physical Parallelism and Controller
    Hierarchy
  • primitive direct-to-device interface
  • Asynchronous and synchronous devices
  • Diversity in Design and Usage
  • application specific, not general purpose
  • huge device variation
  • gt efficient modularity
  • gt migration across HW/SW boundary
  • Robust Operation
  • numerous, unattended, critical
  • gt narrow interfaces

4
Tiny 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)
5
Application Graph of Components
Route map
router
sensor appln
application
Active Messages
Radio Packet
Serial Packet
packet
Temp
photo
SW
Example ad hoc, multi-hop routing of photo
sensor readings
HW
UART
Radio byte
ADC
byte
3450 B code 226 B data
clocks
RFM
bit
Graph of cooperating state machines on shared
stack
6
Programming TinyOS
  • TinyOS 1.0 is written in an extension of C,
    called nesC
  • Applications are too!
  • just additional components composed with the OS
    components
  • Provides syntax for TinyOS concurrency and
    storage model
  • commands, events, tasks
  • local frame variable
  • Rich Compositional Support
  • separation of definition and linkage
  • robustness through narrow interfaces and reuse
  • interpositioning
  • Whole system analysis and optimization

7
Event-Driven Sensor Access Pattern
command result_t StdControl.start() return
call Timer.start(TIMER_REPEAT, 200) event
result_t Timer.fired() return call
sensor.getData() event result_t
sensor.dataReady(uint16_t data)
display(data) return SUCCESS
SENSE
LED
Photo
Timer
  • clock event handler initiates data collection
  • sensor signals data ready event
  • data event handler calls output command
  • device sleeps or handles other activity while
    waiting
  • conservative send/ack at component boundary

8
TinyOS Commands and Events
9
TinyOS Execution Contexts
  • Events generated by interrupts preempt tasks
  • Tasks do not preempt tasks
  • Both essential process state transitions

10
TASKS
  • provide concurrency internal to a component
  • longer running operations
  • are preempted by events
  • able to perform operations beyond event context
  • may call commands
  • may signal events
  • not preempted by tasks

... post TskName() ...
task void TskName ...
11
Components
  • A component specifies a set of interfaces by
    which it is connected to other components
  • provides a set of interfaces to others
  • uses a set of interfaces provided by others
  • Modules
  • provide code that implements one or more
    interfaces and internal behavior
  • Configurations
  • link together components to yield new component
  • Interface
  • logically related set of commands and events
  • Interfaces are bi-directional (include commands
    and events)

12
Example Application Blink
module BlinkM provides interface
StdControl uses interface
Clock interface Leds // Continued next page
Clock.nc interface Clock event result_t
fire() command result_t setRate(char
interval, char scale)
StdControl.nc interface StdControl
command result_t init() command result_t
start() command result_t stop()
13
Module implementation
implementation bool state command result_t
StdControl.init() state FALSE return
SUCCESS command result_t
StdControl.start() return call
Clock.setRate(TOS_I1PS, TOS_S1PS) command
result_t StdControl.stop() return call
Clock.setRate(TOS_I0PS, TOS_S0PS) event
result_t Clock.fire() state !state
if (state) call Leds.redOn() else
call Leds.redOff() return SUCCESS
14
Top level configuration
  • Configuration wires all components together
  • Arrows bind interfaces (on the left) to
    implementation (on the right)

configuration Blink // this module does not
provide any interface implementation
components Main, BlinkM, ClockC, LedsC
Main.StdControl -gt BlinkM.StdControl
BlinkM.Clock -gt ClockC.Clock BlinkM.Leds -gt
LedsC.Leds
15
Compiling, Installing and Running
  • Compiling
  • make mica
  • Installing
  • make mica install
  • Running
  • Live Demo!

16
TinyOS Pros and Cons
  • Pros
  • Static memory allocation gt resource gaurantee.
  • Non-preemptive scheduling gt minimal memory
    requirement.
  • Modulized language gt allow independent software
    development.
  • Cons
  • A brand new programming language
  • Static memory allocation gt resource over
    subscription.
  • Not really an OS.
  • Blur hardware abstraction.
  • No resource management.
  • Simple concurrency model gt lots critical
    sections.
Write a Comment
User Comments (0)
About PowerShow.com