TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
-
Upload
august-chapman -
Category
Documents
-
view
215 -
download
2
Transcript of TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
BackgroundBackground
Created at UCBerkeleyCreated at UCBerkeleyUsed by over 500 groupsUsed by over 500 groups tinyos.nettinyos.netUsesUses
Habitat MonitoringHabitat MonitoringShooter LocalizationShooter LocalizationPursuer-EvaderPursuer-Evader
Design FeaturesDesign Features
Cross-layer controlCross-layer controlStatic Resource allocationStatic Resource allocationSnooping & scheduled communicationSnooping & scheduled communication
Design RequirementsDesign Requirements
Work with current and future designsWork with current and future designsAllow diverse implementation of operating Allow diverse implementation of operating
system services and applicationssystem services and applicationsSupport varying hardwareSupport varying hardwareAddress the unusual challenges of sensor Address the unusual challenges of sensor
networksnetworks
HardwareHardware
Motes-small resource constrained Motes-small resource constrained computing nodescomputing nodes
Mica motesMica motesRadio capable of 40KbpsRadio capable of 40Kbps4Mhz processor4Mhz processor1-4k of ram1-4k of ramUp to 128K of storageUp to 128K of storage32Khz external clock32Khz external clock
General code infoGeneral code info
TinyOS requires 400 bytes for core OSTinyOS requires 400 bytes for core OSSupportsSupports
Event-driven executionEvent-driven executionFlexible concurrency modelFlexible concurrency model
TasksTasksEventsEvents
Component oriented application designComponent oriented application designApps use only the components they needApps use only the components they need
LanguageLanguage
Written in nesCWritten in nesCAn extension of CAn extension of CStripped downStripped downNo function pointersNo function pointersStatic Static
No dynamic memory allocationNo dynamic memory allocationCall-graph fully known at run timeCall-graph fully known at run time
Writing in nesCWriting in nesC
Everything is a componentEverything is a componentModule – application code, implements Module – application code, implements
interfacesinterfacesConfigurations – connect interfacesConfigurations – connect interfaces
All components use modular interfacesAll components use modular interfacesGroup commands and events togetherGroup commands and events togetherBi-directional interfaces to support Bi-directional interfaces to support
hardware interruptshardware interrupts
Writing in nesCWriting in nesC
Discourage sharing of dataDiscourage sharing of dataAsynchronous operation with interruptsAsynchronous operation with interruptsSynchronous operation with tasksSynchronous operation with tasksMake event code atomicMake event code atomicOptimizesOptimizes
Inlines small functionsInlines small functionsEleminates unreachable codeEleminates unreachable code
Reduces cpu usage by 30% and code size by 10%Reduces cpu usage by 30% and code size by 10%
TinyOS featuresTinyOS features
Multi-hop communicationMulti-hop communicationTree-based collectionTree-based collection Intra-network routingIntra-network routingDisseminationDissemination
Broadcast – everyone transmits onceBroadcast – everyone transmits onceEpidemic – send when needed, snoopEpidemic – send when needed, snoop
TinyOS FeaturesTinyOS Features
SchedulingSchedulingTimed listening and communicationTimed listening and communicationReduces collisionsReduces collisionsExtends LifeExtends Life
SynchronizationSynchronizationTime-stamped messagesTime-stamped messagesExternal ClockExternal ClockAccurate to within +/- 1 msAccurate to within +/- 1 ms
Flexible Power SchedulingFlexible Power Scheduling
Idle listening costs tons of powerIdle listening costs tons of powerProvides communication schedules for Provides communication schedules for
local nodeslocal nodesTree based topologyTree based topologyAdaptive slotted communication schedule Adaptive slotted communication schedule
used to route packetsused to route packetsAllows for global routing schedulesAllows for global routing schedulesBase/root nodes have higher duty cyclesBase/root nodes have higher duty cycles
Node States + ReservationsNode States + Reservations
SendingSendingReceivingReceivingAdvertisement – receive from parent node Advertisement – receive from parent node
with available reservation slotwith available reservation slotTransmit pending – send reservation Transmit pending – send reservation
requestrequestReceive pending – receive a reservation Receive pending – receive a reservation
request from childrequest from child IdleIdle
Effects of Power SchedulingEffects of Power Scheduling
High efficiency AA battery gives about 221 High efficiency AA battery gives about 221 hours or 9 days of operation without power hours or 9 days of operation without power management.management.
1274 hours or 53 days of operation with 1274 hours or 53 days of operation with power schedulingpower scheduling
Can be increased even moreCan be increased even more
Trickle – A TinyOS componentTrickle – A TinyOS component
““A self-regulating algorithm for code A self-regulating algorithm for code propagation and maintenance in wireless propagation and maintenance in wireless sensor networks”sensor networks”Designed with 3 principlesDesigned with 3 principles
Low maintenance – scalable and infrequent data Low maintenance – scalable and infrequent data exchangesexchanges
Rapid propagation – must be able to update every Rapid propagation – must be able to update every node in a network within 2 minsnode in a network within 2 mins
Scalability – handle few to hundreds of neighbors, Scalability – handle few to hundreds of neighbors, don’t rely on mapped info because wireless don’t rely on mapped info because wireless networks changenetworks change
Trickle’s (Polite Gossip)Trickle’s (Polite Gossip)
Periodically broadcast code summaries to local Periodically broadcast code summaries to local neighborsneighbors
Stay quiet if another neighbor has broadcast Stay quiet if another neighbor has broadcast identical code summaryidentical code summary
Older summaries result in broadcast of an Older summaries result in broadcast of an updateupdate
Newer summaries result in request for updateNewer summaries result in request for update Few seconds of operation an hourFew seconds of operation an hour Prevents network floodingPrevents network flooding
Trickle’s CodeTrickle’s Code
Requires only 11 bytes of state on nodeRequires only 11 bytes of state on nodeBroadcasts and listens every interval I for Broadcasts and listens every interval I for
time Ttime TTransmission time is T/2Transmission time is T/2
Max of 2 transmissions every interval iMax of 2 transmissions every interval iTransmissions suppress other broadcastsTransmissions suppress other broadcastsEach node has a 1/(num of local node/ Each node has a 1/(num of local node/
max 75) chance of broadcastingmax 75) chance of broadcasting
Trickle’s CodeTrickle’s Code
If over 75 neighbors, collisions begin to If over 75 neighbors, collisions begin to happenhappen512/75 or 1024/75 chance of broadcasting512/75 or 1024/75 chance of broadcasting
Does not have overhead of discovering Does not have overhead of discovering and maintaining local groupsand maintaining local groups
Trickle’s BenefitsTrickle’s Benefits
Traditionally – have to rebroadcast all Traditionally – have to rebroadcast all code to entire network if a node code to entire network if a node disconnects for a whiledisconnects for a while
Trickle – local distribution where neededTrickle – local distribution where neededTremendous power savingsTremendous power savings
1 bit broadcasted costs 1000 cpu cycles of 1 bit broadcasted costs 1000 cpu cycles of powerpower
64k file costs days worth of operation time64k file costs days worth of operation time
TinyDB – A TinyOS componentTinyDB – A TinyOS component
Problems with databases in wireless Problems with databases in wireless networksnetworksFrequency of queriesFrequency of queriesRelevance of a node’s dataRelevance of a node’s dataOrder of query samplesOrder of query samples Is a sample worth processing? Is a sample worth processing?
TinyDB featuresTinyDB features
Query optimizationQuery optimizationDo work on motes to reduce broadcast sizeDo work on motes to reduce broadcast sizeEliminate recursive queriesEliminate recursive queries
Identification of similar or unchanged infoIdentification of similar or unchanged infoAbility to specify sampling rate and Ability to specify sampling rate and
minimum sampling rateminimum sampling rateDynamic adjustment of sampling rate Dynamic adjustment of sampling rate
based upon power and minimum specified based upon power and minimum specified lifetimelifetime
Deluge – A variant of TrickleDeluge – A variant of Trickle
Trickle is designed for single packet Trickle is designed for single packet disseminationdissemination
Deluge designed to handle large data Deluge designed to handle large data objectsobjects
Deluge FeaturesDeluge Features
Message suppressionMessage suppressionRobust asymmetric link creationRobust asymmetric link creation
Get rid of bad and find new neighborsGet rid of bad and find new neighborsDynamic advertisement rate adjustmentDynamic advertisement rate adjustmentMinimize collisions in node cellsMinimize collisions in node cellsSpatial multiplexing allows parallel Spatial multiplexing allows parallel
transfers of datatransfers of data
How Deluge worksHow Deluge works
Divides data objects into fixed-size pagesDivides data objects into fixed-size pagesBroadcasts all pages, in orderBroadcasts all pages, in orderMust receive 1 page before can start the Must receive 1 page before can start the
nextnext16 bit cyclic redundancy checks 16 bit cyclic redundancy checks Updates OS by pageUpdates OS by pageCapable of catching up nodes with only Capable of catching up nodes with only
local communicationlocal communication
ConclusionsConclusions
TinyOS is a highly customizable and TinyOS is a highly customizable and adaptable operating system.adaptable operating system.
Used by hundreds of reported groups.Used by hundreds of reported groups.Open source.Open source.Dozens of modules available for download Dozens of modules available for download
for free at tinyos.netfor free at tinyos.net
Any Questions?Any Questions?