2 tinyos

Information about 2 tinyos

Published on October 29, 2007

Author: CoolDude26

Source: authorstream.com

Content

Programming TinyOS:  Programming TinyOS David Culler, Phil Levis, Rob Szewczyk, Joe Polastre University of California, Berkeley Intel Research Berkeley Characteristics of Network Sensors:  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 => efficient modularity => migration across HW/SW boundary Robust Operation numerous, unattended, critical => narrow interfaces A Operating System for Tiny Devices?:  A 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 Tiny OS Concepts:  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 Messaging Component init Power(mode) TX_packet(buf) TX_packet_done (success) RX_packet_done (buffer) Internal State init power(mode) send_msg(addr, type, data) internal thread Commands Events Application = Graph of Components:  Application = Graph of Components RFM Radio byte Radio Packet UART Serial Packet ADC Temp photo Active Messages clocks bit byte packet Route map router sensor appln application HW SW Example: ad hoc, multi-hop routing of photo sensor readings 3450 B code 226 B data Graph of cooperating state machines on shared stack TOS Execution Model:  TOS 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 event-driven bit-pump event-driven byte-pump event-driven packet-pump message-event driven active message application comp encode/decode crc data processing Dynamics of Events and Threads:  Dynamics of Events and Threads bit event filtered at byte layer bit event => end of byte => end of packet => end of msg send thread posted to start send next message radio takes clock events to detect recv Programming TinyOS:  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 Event-Driven Sensor Access Pattern:  Event-Driven Sensor Access Pattern 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 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 Timer Photo LED TinyOS Commands and Events:  TinyOS Commands and Events { ... status = call CmdName(args) ... } command CmdName(args) { ... return status; } { ... status = signal EvtName(args) ... } event EvtName)(args) { ... return status; } TinyOS Execution Contexts:  TinyOS Execution Contexts Events generated by interrupts preempt tasks Tasks do not preempt tasks Both essential process state transitions TASKS:  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 { ... } Typical application use of tasks:  Typical application use of tasks event driven data acquisition schedule task to do computational portion event result_t sensor.dataReady(uint16_t data) { putdata(data); post processData(); return SUCCESS; } task void processData() { int16_t i, sum=0; for (i=0; i ‹ maxdata; i++) sum += (rdata[i] ›› 7); display(sum ›› shiftdata); } 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) Tasks in low-level operation:  Tasks in low-level operation transmit packet send command schedules task to calculate CRC task initiated byte-level data pump 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 Example: Radio Byte Operation:  Example: Radio Byte Operation 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 Bit transmission Byte 1 Byte 2 RFM Bits Byte 2 Byte 1 Byte 3 Byte 3 Byte 4 start … Hardware accelerators in MICA eliminate bit pumps Task Scheduling:  Task Scheduling Currently simple fifo scheduler Bounded number of pending tasks When idle, shuts down node except clock Uses non-blocking task queue data structure Simple event-driven structure + control over complete application/system graph instead of complex task priorities and IPC Tiny Active Messages:  Tiny Active Messages Sending Declare buffer storage in a frame Request Transmission Name 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 Sending a message:  Sending a message Refuses to accept command if buffer is still full or network refuses to accept send command User component provide structured msg storage Send done event:  Send done event Send done event fans out to all potential senders Originator determined by match free buffer on success, retry or fail on failure Others use the event to schedule pending communication event result_t IntOutput.sendDone(TOS_MsgPtr msg, result_t success) { if (pending && msg == &data) { pending = FALSE; signal IntOutput.outputComplete(success); } return SUCCESS; } } Receive Event:  Receive Event Active message automatically dispatched to associated handler knows the format, no run-time parsing performs action on message event Must return free buffer to the system typically the incoming buffer if processing complete event TOS_MsgPtr ReceiveIntMsg.receive(TOS_MsgPtr m) { IntMsg *message = (IntMsg *)m->data; call IntOutput.output(message->val); return m; } Maintaining Scheduling Agility:  Maintaining Scheduling Agility Need logical concurrency at many levels of the graph While meeting hard timing constraints sample the radio in every bit window Retain event-driven structure throughout application Tasks extend processing outside event window All operations are non-blocking The Complete Application:  SecDedEncode The Complete Application RadioCRCPacket UART UARTnoCRCPacket ADC phototemp AMStandard ClockC bit byte packet SenseToRfm HW SW IntToRfm MicaHighSpeedRadioM RandomLFSR SPIByteFIFO SlavePin noCRCPacket Timer photo generic comm Composition:  Composition 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 Interfaces are bi-directional include commands and events Interface methods are the external namespace of the component Timer Component StdControl Timer Clock provides uses provides interface StdControl; interface Timer: uses interface Clock Components:  Components 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 StdControl.nc interface StdControl { command result_t init(); command result_t start(); command result_t stop(); } Clock.nc interface Clock { command result_t setRate(char interval, char scale); event result_t fire(); } Example top level configuration:  Example top level configuration configuration SenseToRfm { // this module does not provide any interface } implementation { components Main, SenseToInt, IntToRfm, ClockC, Photo as Sensor; Main.StdControl -> SenseToInt; Main.StdControl -> IntToRfm; SenseToInt.Clock -> ClockC; SenseToInt.ADC -> Sensor; SenseToInt.ADCControl -> Sensor; SenseToInt.IntOutput -> IntToRfm; } SenseToInt Main StdControl ADCControl IntOutput Clock ADC Nested configuration:  Nested configuration includes IntMsg; configuration IntToRfm { provides { interface IntOutput; interface StdControl; } } implementation { components IntToRfmM, GenericComm as Comm; IntOutput = IntToRfmM; StdControl = IntToRfmM; IntToRfmM.Send -> Comm.SendMsg[AM_INTMSG]; IntToRfmM.SubControl -> Comm; } IntToRfmM GenericComm StdControl IntOutput SubControl SendMsg[AM_INTMSG]; IntToRfm Module:  IntToRfm Module includes IntMsg; module IntToRfmM { uses { interface StdControl as SubControl; interface SendMsg as Send; } provides { interface IntOutput; interface StdControl; } } implementation { bool pending; struct TOS_Msg data; command result_t StdControl.init() { pending = FALSE; return call SubControl.init(); } command result_t StdControl.start() { return call SubControl.start(); } command result_t StdControl.stop() { return call SubControl.stop(); } command result_t IntOutput.output(uint16_t value) { ... if (call Send.send(TOS_BCAST_ADDR, sizeof(IntMsg), &data) return SUCCESS; ... } event result_t Send.sendDone(TOS_MsgPtr msg, result_t success) { ... } } A Multihop Routing Example:  A Multihop Routing Example Sample Components:  Sample Components Communication Radio, UART, I2C of various flavors Timing Timer, Clock Sensors voltage, photo, light Busses i2c, SPI Storage eeprom, logger Energy management snooze Components => Services:  Components => Services Multihop Routing Time synchronization Identity, Discovery ... Supporting HW evolution:  Supporting HW evolution Distribution broken into apps: top-level applications lib: shared application components system: hardware independent system components platform: hardware dependent system components includes HPLs and hardware.h Component design so HW and SW look the same example: temp component may abstract particular channel of ADC on the microcontroller may be a SW i2C protocol to a sensor board with digital sensor or ADC HW/SW boundary can move up and down with minimal changes Scalable Simulation Environment:  Scalable Simulation Environment target platform: TOSSIM whole application compiled for host native instruction set event-driven execution mapped into event-driven simulator machinery storage model mapped to thousands of virtual nodes radio model and environmental model plugged in bit-level fidelity Sockets = basestation Complete application including GUI Simulation Scaling:  Simulation Scaling Current Areas of Development:  Current Areas of Development Security Safe Concurrency atomicity support automatic race detection Abstract Components Where to go for more?:  Where to go for more? http://www.tinyos.net/tos/ http://sourceforge.net/projects/tinyos/ Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kristofer Pister. System architecture directions for network sensors. ASPLOS 2000. David E. Culler, Jason Hill, Philip Buonadonna, Robert Szewczyk, and Alec Woo. A Network-Centric Approach to Embedded Software for Tiny Devices. EMSOFT 2001.

Related presentations


Other presentations created by CoolDude26

CH8 PowerPoint Robotics
31. 12. 2007
0 views

CH8 PowerPoint Robotics

challenging behavior
17. 09. 2007
0 views

challenging behavior

ch1
17. 09. 2007
0 views

ch1

IP P mohan
19. 09. 2007
0 views

IP P mohan

RMP October 2006 Data
11. 10. 2007
0 views

RMP October 2006 Data

standing2
12. 10. 2007
0 views

standing2

lam talk
15. 10. 2007
0 views

lam talk

Escher
15. 10. 2007
0 views

Escher

2006 Radicarbon History
16. 10. 2007
0 views

2006 Radicarbon History

pre b373
17. 10. 2007
0 views

pre b373

banderas2
22. 10. 2007
0 views

banderas2

ostrichsm
17. 09. 2007
0 views

ostrichsm

209 OASIS Ostrich presentation
17. 09. 2007
0 views

209 OASIS Ostrich presentation

ssec software development
07. 10. 2007
0 views

ssec software development

dianxinyezhuanxing
12. 10. 2007
0 views

dianxinyezhuanxing

africa presentation
23. 10. 2007
0 views

africa presentation

spatial databases
23. 10. 2007
0 views

spatial databases

vollhardt lecc2005
17. 10. 2007
0 views

vollhardt lecc2005

232nm13
29. 10. 2007
0 views

232nm13

ans321L2
17. 09. 2007
0 views

ans321L2

Plan Bleu partie2
24. 10. 2007
0 views

Plan Bleu partie2

05 galaxies
29. 08. 2007
0 views

05 galaxies

nuclearWeapons
23. 12. 2007
0 views

nuclearWeapons

ChristensenNov2
29. 08. 2007
0 views

ChristensenNov2

Unit3
03. 01. 2008
0 views

Unit3

como fazer palestra espirita
07. 01. 2008
0 views

como fazer palestra espirita

XES Architecture Vacuum v2
17. 09. 2007
0 views

XES Architecture Vacuum v2

Lecture16 overheads
21. 08. 2007
0 views

Lecture16 overheads

Hip Injuries in Athletics PartI
01. 08. 2007
0 views

Hip Injuries in Athletics PartI

jsimon irvine
29. 08. 2007
0 views

jsimon irvine

GeorgeMiley LOFAR May06
29. 08. 2007
0 views

GeorgeMiley LOFAR May06

jim brady
05. 10. 2007
0 views

jim brady

automotive invitation
24. 10. 2007
0 views

automotive invitation

microscopy
15. 10. 2007
0 views

microscopy

General Psychopathology
16. 02. 2008
0 views

General Psychopathology

The Virus of Violence
20. 02. 2008
0 views

The Virus of Violence

cindy pragma grid
17. 10. 2007
0 views

cindy pragma grid

ASOCallPresentation2 006WBSD
18. 03. 2008
0 views

ASOCallPresentation2 006WBSD

China Korea Trip Info
25. 03. 2008
0 views

China Korea Trip Info

A105 021 GalI
29. 08. 2007
0 views

A105 021 GalI

widefield yan
29. 08. 2007
0 views

widefield yan

blain cosmoskyoto
29. 08. 2007
0 views

blain cosmoskyoto

Corporate Profile November 2007
27. 03. 2008
0 views

Corporate Profile November 2007

Cal Mrtg Watkins
10. 04. 2008
0 views

Cal Mrtg Watkins

pcreek
13. 04. 2008
0 views

pcreek

7 9 kraft
29. 08. 2007
0 views

7 9 kraft

neos innovation challenge short
14. 04. 2008
0 views

neos innovation challenge short

nslab diffserv 06a
16. 04. 2008
0 views

nslab diffserv 06a

podraza medicare
17. 04. 2008
0 views

podraza medicare

Capitalizing
18. 04. 2008
0 views

Capitalizing

Meyer
22. 04. 2008
0 views

Meyer

forbes manhattan presentation
28. 04. 2008
0 views

forbes manhattan presentation

cs4811 ch09 uncertainty
17. 09. 2007
0 views

cs4811 ch09 uncertainty

Managing Tough Decisions
17. 09. 2007
0 views

Managing Tough Decisions

David Ellis powerpoint
30. 04. 2008
0 views

David Ellis powerpoint

Anesthetic Machines
02. 05. 2008
0 views

Anesthetic Machines

ADSL NTT
09. 10. 2007
0 views

ADSL NTT

ABM12006
15. 10. 2007
0 views

ABM12006

Richstone Mitchell
29. 08. 2007
0 views

Richstone Mitchell

CIP TOA and Beyond 5 29 07
03. 01. 2008
0 views

CIP TOA and Beyond 5 29 07

Thomson top panic05
18. 06. 2007
0 views

Thomson top panic05

Thesis defense rev12
18. 06. 2007
0 views

Thesis defense rev12

tftge dec 02
18. 06. 2007
0 views

tftge dec 02

Temp bone trauma slides 051012
18. 06. 2007
0 views

Temp bone trauma slides 051012

tamara
18. 06. 2007
0 views

tamara

tactical euro condor06
18. 06. 2007
0 views

tactical euro condor06

Stolarz D 1603
18. 06. 2007
0 views

Stolarz D 1603

stoc04
18. 06. 2007
0 views

stoc04

stabicp slides
18. 06. 2007
0 views

stabicp slides

Sofia Sima 2 ext new
18. 06. 2007
0 views

Sofia Sima 2 ext new

slacbaryo genesis
18. 06. 2007
0 views

slacbaryo genesis

iyef project homeless connect
31. 10. 2007
0 views

iyef project homeless connect

SOFG
18. 06. 2007
0 views

SOFG

NorthStar
13. 11. 2007
0 views

NorthStar

rickwilliams
21. 08. 2007
0 views

rickwilliams

Noah s Ark
03. 10. 2007
0 views

Noah s Ark

ambertech
19. 11. 2007
0 views

ambertech

Soc RespI SOC02
17. 09. 2007
0 views

Soc RespI SOC02

Internet Protocol Addresses
15. 06. 2007
0 views

Internet Protocol Addresses

Colour Reconnection
15. 06. 2007
0 views

Colour Reconnection

Research & Development
15. 06. 2007
0 views

Research & Development

Low Frequency Gravitational Wave
15. 06. 2007
0 views

Low Frequency Gravitational Wave

vander Marel mgct2 win
29. 08. 2007
0 views

vander Marel mgct2 win

G020514 00
17. 09. 2007
0 views

G020514 00

aas calzetti
29. 08. 2007
0 views

aas calzetti

jokes riddles
17. 09. 2007
0 views

jokes riddles

vaulttutorial
19. 09. 2007
0 views

vaulttutorial

Ch90 ExtensionsToFOPC
17. 09. 2007
0 views

Ch90 ExtensionsToFOPC

Mercurio
29. 08. 2007
0 views

Mercurio

Eric Gawiser pire galclust
29. 08. 2007
0 views

Eric Gawiser pire galclust

Eric Gawiser pire galform
29. 08. 2007
0 views

Eric Gawiser pire galform

1 Dirk Van Braeckel
23. 10. 2007
0 views

1 Dirk Van Braeckel

directors roundtable 0407
02. 10. 2007
0 views

directors roundtable 0407

MWR
01. 08. 2007
0 views

MWR

01 Singleton
17. 09. 2007
0 views

01 Singleton

astro101 2000oct
15. 11. 2007
0 views

astro101 2000oct

CCAT06 Chapman
29. 08. 2007
0 views

CCAT06 Chapman

nips06 tutorial
17. 09. 2007
0 views

nips06 tutorial

90convexpo Jeff Tobe ppt
17. 09. 2007
0 views

90convexpo Jeff Tobe ppt