SlideShare a Scribd company logo
1 of 77
TinyOS
Learning Objectives
• Understand TinyOS – the dominant open
source operating systems for WSN
– Hardware abstraction architecture (HAA)
– TinyOS architecture and component model
– Main characteristics of TinyOS 2
• Understand NesC programmng
• Learn representative WSN applications
Prerequisites
• Module 1
• Basic concepts of Operating Systems
• Basic concepts of Object-oriented Design and
Analysis
• Basic concepts of Computer Networks
http://www.tinyos.net 4
Software Challenges - TinyOS
• Power efficient
– Put microcontroller and radio to sleep
• Small memory footprint
– Non-preemptable FIFO task scheduling
• Efficient modularity
– Function call (event and command) interface between
commands
• Application specific
• Concurrency-intensive operation
– Event-driven architecture
– No user/kernel boundary
[TinyOS_1]: Table 2 5
TinyOS Hardware Abstraction
Architecture (HAA)
• Section 2.3 and Figure 2.5 of J. Polastre Dissertation:
http://www.polastre.com/papers/polastre-thesis-final.pdf
TinyOS Hardware Abstraction
Architecture (HAA)
Ref: Figure 2.4 of J. Polastre Dissertation
http://www.polastre.com/papers/polastre-thesis-final.pdf
Traditional OS Architectures
Problem with Large Scale Deeply embedded system..
• Large memory & storage requirement
• Unnecessary and overkill functionality ( address space isolation,
complex I/O subsystem , UI ) for our scenario.
• Relative high system overhead ( e.g, context switch )
• Require complex and power consuming hardware support.
VM I/O Scheduler
Application 1 Application 2
Monolith-kernel
HW
NFS I/O
Scheduler
Application 1
Micro-kernel
HW
IPC VM
NO Kernel Direct hardware manipulation
NO Process management Only one process on the fly.
NO Virtual memory Single linear physical address space
NO Dynamic memory allocation Assigned at compile time
NO Software signal or exception Function Call instead
Goal: to strip down memory size and system overhead.
TinyOS Architecture Overview (1)
I/O COMM . …….
Scheduler TinyOS
Application
Component
Application
Component
Application
Component
TinyOS Overview
• Application = scheduler + graph of components
– Compiled into one executable
• Event-driven architecture
• Single shared stack
• No kernel/user space differentiation
Communication
Actuating Sensing Communication
Application (User Components)
Main (includes Scheduler)
Hardware Abstractions
[TinyOS_4] 10
TinyOS Component Model
• Component has:
– Frame (storage)
– Tasks: computation
– Interface:
• Command
• Event
• Frame: static storage model - compile time
memory allocation (efficiency)
• Command and events are function calls
(efficiency)
Messaging Component
Internal StateInternal Tasks
Commands Events
The mote revolution: Low Powr
Wireless Sensor Network
12
Typical WSN Application
• Periodic
– Data Collection
– Network Maintenance
– Majority of operation
• Triggered Events
– Detection/Notification
– Infrequently occurs
• But… must be reported
quickly and reliably
• Long Lifetime
– Months to Years without
changing batteries
– Power management is the key
to WSN success
sleep
wakeup
processing
data acquisition
communication
Power
Time
The mote revolution: Low Powr
Wireless Sensor Network
13
Design Principles
• Key to Low Duty Cycle Operation:
– Sleep – majority of the time
– Wakeup – quickly start processing
– Active – minimize work & return to sleep
The mote revolution: Low Powr
Wireless Sensor Network
14
Minimize Power Consumption
• Compare to Mica2: a MicaZ mote with AVR mcu and 802.15.4 radio
• Sleep
– Majority of the time
– Telos: 2.4mA
– MicaZ: 30mA
• Wakeup
– As quickly as possible to process and return to sleep
– Telos: 290ns typical, 6ms max
– MicaZ: 60ms max internal oscillator, 4ms external
• Active
– Get your work done and get back to sleep
– Telos: 4-8MHz 16-bit
– MicaZ: 8MHz 8-bit
Power Consumption
Energy Consumption
• Idle listen:receive:send = 1:1.05:1.4
[Introduction_2]: Figure 3 17
TinyOS Radio Stack
[Introduction_2]: Table 2 18
Code and Data Size Breakdown
WSN Protocol Stack
Ref: [Introduction_1] “A Survey on Sensor Networks,” IEEE
Communications Magazine, Aug. 2002, pp. 102-114.
TinyOS 2
• An operating system for tiny, embedded, and
networked sensors
• NesC language
– A dialect of C Language with extensions for components
• Three Limitations
– Application complexity
– High cost of porting to a new platform
– reliability
• Little more that a non-preemptive scheduler
• Component-based architecture
• Event-driven
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
TinyOS 2
• Static binding and allocation
– Every resource and service is bound at compile time and all
allocation is static
• Single thread of control
• Non-blocking calls
– A call to start lengthy operation returns immediately
– the called component signals when the operation is
complete
– Split phase
– See this link for one example
http://docs.tinyos.net/index.php/Modules_and_the_TinyOS_Exe
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
• Ref: [TinyOS_3] Section 2.1
TinyOS 2
• The scheduler has a fixed-length queue, FIFO
• Task run atomically
• Interrupt handlers can only call code that has the async
keyword
• Complex interactions among components
• Event
– In most mote applications, execution is driven solely by
timer events and the arrival of radio messages
• ATmega128 has two 8-bit timers and two 16-bit timers
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
TinyOS 2
• sync code is non-preemptive,
– when synchronous (sync) code starts running, it does not relinquish the
CPU to other sync code until it completes
• Tasks
– enable components to perform general-purpose "background"
processing in an application
– A function which a component tells TinyOS to run later, rather than
now
• The post operation places the task on an internal task queue
which is processed in FIFO order
• Tasks do not preempt each other
• A Task can be preempted by a hardware interrupt
• See TinyOS lesson:
– Modules and the TinyOS Execution Model
802.15.4 and CC2420
• CC2420 hardware signals packet reception by
triggering an interrupt
• The software stack is responsible for reading
the received bytes out of CC2420’s memory;
• The software stack sends a packet by writing it
to CC2420’s memory then sending a transmit
command
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
TinyOS 2
• Platforms
– MicaZ, Mica2, etc;
– Compositions of chips
• Chips
– MCU, radio, etc
– Each chip follows the HAA model, with a HIL
implementation at the top
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
TinyOS 2
• A T2 packet has a fixed size data payload
which exists at a fixed offset
• The HIL of a data link stack is an active
message interface
• Zero-copy
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded
Sensor Networks”
Scheduler in TinyOS 2.x
SchedulerBasicP.nc of TinyOS 2.x
TinyOS Serial Stack
• Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor
Networks”
Device Drivers in T2
• Virtualized
• Dedicated
• Shared
• Ref: Section 3 of [Energy_1]
[TinyOS_1]: Section 5 30
T2 Timer Subsystem
• MCU comes with a wide variation of hardware
timers
– ATmega128: two 8-bit timers and two 16-bit times
– MSP430: two 16-bit timers
• Requirement of Timer subsystem
– Different sampling rates: one per day to 10kHz
T2 Timer Subsystem
• See interface at:
– tos/lib/timer/Timer.nc
One Example TinyOS Application -
BlinkC
• http://docs.tinyos.net/index.php/TinyOS_Tutor
ials
One Example of Wiring
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
AppM
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
AppM
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
Sensor Interface
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
Initialize Interface
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
SensorC
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
AppC
• Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
Notation
CTP Routing Stack
Parameterized Interfaces
• An interface array
•Ref: D. Gay, et al. “Software Design Patterns for TinyOS”, Section 2.3
unique and uniqueCount
• Want to use a single element of a
parameterized interface and does not care
which one, as long as no one else use it
• Want to know the number of different values
returned by unique
•Ref: D. Gay, et al. “Software Design Patterns for TinyOS”, Section 2.4
section 4.5 "TinyOS Programming
manual"
44
async
• Functions that can run preemptively are
labeled with async keyword
• Command an async function calls and events
an async function signals must be async
• All interrupt handlers are async
• atomic keyword
– Race conditions, data races
Generic Components and Typed
Interface
• Have at least one type parameter
• Generic Components are NOT singletons
– Can be instantiated within an configuration
– Instantiated with the keyword new (Singleton
components are just named)
/tos/lib/timer/VirtualizeTimerC.n 46
Example - VirtualizeTimerC
• Use a single timer to create up to 255 virtual timers
• generic module VirtualizeTimerC(typedef
precision_tag, int max_timers)
• Precision_tag: A type indicating the precision of the Timer being
virtualized
• max_timers: Number of virtual timers to create.
• How to use it?
– Components new VirtualizeTimerC(TMilli, 3) as TimerA
• This will allocate three timers
– Components new VirtualizeTimerC(TMilli, 4) as TimerB
• This will allocate three timers
• Ref:
– /tos/lib/timer/VirtualizeTimerC.nc
– Section 7.1 of “TinyOS Programming Manual”
Virtualized Timer
Figure 4 of [TinyOS_1] 48
Timer Stack on MicaZ/Mica2
Timer Subsystem
• HplTimer[0-3]C provide dedicated access to
the two 8-bit and two 16-bit timers of
ATmega128 MCU
• T2 subsystem is built over the 8-bit timer 0
• Timer 1 is used for CC2420 radio
message_t
• tos/types/message.h
• Ref. TEP 111
• Every link layer defines its header, footer, and
metadata structures
Relationship between CC1000 Radio
Implementation and message_t
• tos/chips/cc1000/CC1000Msg.h
Relationship between CC2420 Radio
Implementation and message_t
• tos/chips/cc2420/CC2420.h
Relationship between Serial Stack
Packet Implementation and message_t
• tinyos-2.x/tos/lib/serial/Serial.h
Active Message (AM)
• Why do we need AM?
– Because it is very common to have multiple
services using the same radio to communicate
– AM layer to multiplex access to the radio
• make micaz install,n
– n: unique identifier for a node
Active Message
• Every message contains the name of an event handler
• Sender
– Declaring buffer storage in a frame
– Naming a handler
– Requesting Transmission
– Done completion signal
• Receiver
– The event handler is fired automatically in a target node
 No blocked or waiting threads on the receiver
 Behaves like any other events
 Single buffering
 Double Check!!!!!!!
TinyOS Component
• Two types of components
– Module: provide implementations of one or more
interfaces
– Configuration: assemble other components
together
TinyOS Component Model
• Component has:
– Frame (storage)
– Tasks: computation
– Interface:
• Command
• Event
• Frame: static storage model - compile time
memory allocation (efficiency)
• Command and events are function calls
(efficiency)
Messaging Component
Internal StateInternal Tasks
Commands Events
Structure of a Component
TinyOS Component
Command Handlers
Event Handlers
Set of Tasks
Frame
(containing state information)
TinyOS Two-level Scheduling
• Tasks do computations
– Non-preemptable FIFO scheduling
– Bounded number of pending tasks
• Events handle concurrent dataflows
– Interrupts trigger lowest level events
– Events prempt tasks, tasks do not
– Events can signal events, call commands, or post tasks
Hardware
Interrupts
events
commands
FIFO
Tasks
POST
Preempt
Time
commands
TinyOS Applications
• In most mote applications, execution is driven
solely by timer events and the arrival of radio
messages
How to Program motes Under TinyOS
• make telosb install,n mib510,/dev/ttyUSB0
• make telosb install,1 mib510,/dev/ttyUSB0
Representative WSN Applications
• BaseStation – Listen – BlinkToRadio
– One-hop WSN application to collect sensed values
• OscilloScope
– one-hop WSN application with GUI interface
• MultiOscilloScopre
– multihop WSN application
• Octopus
– multi-hop WSN application with a more dynamic display
of network topology and data dissemination functions
Application Example - BaseStation,
Listen and BlinkToRadio
Application Example - Oscilloscope
Application Example -
MultihopOscilloscope
Application Example - MViz
MViz
Application Example - Octopus
• http://csserver.ucd.ie/~rjurdak/Octopus.htm
Octopus
BaseStation – Listen - BlinkToRadio
OscilloScope
MultihopOscilloscope
MViz
Octopus
Lab 1
• a) Write a PingPong application that runs on
two nodes. When a node boots, it sends a
broadcast packet using the AMSend interface.
When it receives a packet, it a) wait one
second; b) sends a packet; c) toggle an LED
whenever a node sends a packet.
Lab 2
• b) Please add the reliable data transmission feature to the PingPong
application from the Application and Link layer, respectively. Suppose
that two motes A and B are talking to each other.
I. Application Layer: When mote A sends a broadcast pack P to node B,
mote A will start a timer T. When mote B receives the packet P, mote B
will send an ACK to node A.
b.1 If the timer T expires before mote A receives the ACK from mote B
(either the packet P or the ACK is lost), mote A will retransmit the packet;
b.2 If mote A receives the ACK from mote B before the timer T expires,
mote A will do nothing when the timer T expires.
b.3 If mote B receive a packet which has already been received (based on
sequence number), node B just drop this packet.
There is a sequence number included in the payload of the packet P. The
sequence number starts from 0. When a packet P is received, the receiver
will display the bottom three bits (through LEDs) of the sequence number
in the packet P.
Lab 2 - continue
• II. Link Layer: In TEP 126 (http://www.tinyos.net/tinyos-
2.x/doc/html/tep126.html), it says:
“PacketLink: This layer provides automatic retransmission
functionality and is responsible for retrying a packet
transmission if no acknowledgement was heard from the
receiver. PacketLink is activated on a per-message basis,
meaning the outgoing packet will not use PacketLink unless it
is configured ahead of time to do so”
Therefore, as an alternative, you may also configure
PacketLink to provide automatic retransmission functionality.
Assignment
• 1. What is the relationship among all the
application components in the Oscilloscope
application?
• 2. please give two examples of split-phase
operations in TinyOS 2.
• 3. What is the usage of Active Message in
TinyOS 2?
• 4. Why doesn’t TinyOS 2 make every
statement async?

More Related Content

What's hot

SENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSSENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSjuno susi
 
Unit 4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...
Unit  4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...Unit  4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...
Unit 4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...Darwin Nesakumar
 
Protocols for wireless sensor networks
Protocols for wireless sensor networks Protocols for wireless sensor networks
Protocols for wireless sensor networks DEBABRATASINGH3
 
Energy consumption of wsn
Energy consumption of wsnEnergy consumption of wsn
Energy consumption of wsnDeepaDasarathan
 
Classification of routing protocols
Classification of routing protocolsClassification of routing protocols
Classification of routing protocolsMenaga Selvaraj
 
WSN-IEEE 802.15.4 -MAC Protocol
WSN-IEEE 802.15.4 -MAC ProtocolWSN-IEEE 802.15.4 -MAC Protocol
WSN-IEEE 802.15.4 -MAC ProtocolArunChokkalingam
 
Mac protocols
Mac protocolsMac protocols
Mac protocolsjuno susi
 
Introduction To Tiny Os And Contiki Os
Introduction To Tiny Os And Contiki OsIntroduction To Tiny Os And Contiki Os
Introduction To Tiny Os And Contiki OsSudharsan S
 
SPINS: Security Protocols for Sensor Networks
SPINS: Security Protocols for Sensor NetworksSPINS: Security Protocols for Sensor Networks
SPINS: Security Protocols for Sensor NetworksAbhijeet Awade
 

What's hot (20)

SENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSSENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLS
 
Unit 4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...
Unit  4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...Unit  4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...
Unit 4 ec8702 - ad hoc and wireless sensor networks unit -4 mr.darwin nesaku...
 
Protocols for wireless sensor networks
Protocols for wireless sensor networks Protocols for wireless sensor networks
Protocols for wireless sensor networks
 
WLAN
WLANWLAN
WLAN
 
Energy consumption of wsn
Energy consumption of wsnEnergy consumption of wsn
Energy consumption of wsn
 
Classification of routing protocols
Classification of routing protocolsClassification of routing protocols
Classification of routing protocols
 
Wireless Sensor Networks
Wireless Sensor NetworksWireless Sensor Networks
Wireless Sensor Networks
 
WSN-IEEE 802.15.4 -MAC Protocol
WSN-IEEE 802.15.4 -MAC ProtocolWSN-IEEE 802.15.4 -MAC Protocol
WSN-IEEE 802.15.4 -MAC Protocol
 
Sensor Network
Sensor NetworkSensor Network
Sensor Network
 
6lowpan
6lowpan6lowpan
6lowpan
 
Mac protocols
Mac protocolsMac protocols
Mac protocols
 
Wsn 08
Wsn 08Wsn 08
Wsn 08
 
IS-95 Cdma
IS-95 CdmaIS-95 Cdma
IS-95 Cdma
 
Introduction To Tiny Os And Contiki Os
Introduction To Tiny Os And Contiki OsIntroduction To Tiny Os And Contiki Os
Introduction To Tiny Os And Contiki Os
 
Amps
AmpsAmps
Amps
 
Isdn networking
Isdn networkingIsdn networking
Isdn networking
 
UMTS, Introduction.
UMTS, Introduction.UMTS, Introduction.
UMTS, Introduction.
 
Cdma2000
Cdma2000Cdma2000
Cdma2000
 
SPINS: Security Protocols for Sensor Networks
SPINS: Security Protocols for Sensor NetworksSPINS: Security Protocols for Sensor Networks
SPINS: Security Protocols for Sensor Networks
 
wireless sensor network
wireless sensor networkwireless sensor network
wireless sensor network
 

Viewers also liked

Memory Organization
Memory OrganizationMemory Organization
Memory OrganizationAcad
 
input output Organization
input output Organizationinput output Organization
input output OrganizationAcad
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
Cluster analysis
Cluster analysisCluster analysis
Cluster analysisAcad
 
Union from C and Data Strutures
Union from C and Data StruturesUnion from C and Data Strutures
Union from C and Data StruturesAcad
 
Data retrieval in sensor networks
Data retrieval in sensor networksData retrieval in sensor networks
Data retrieval in sensor networksAcad
 
pipeline and vector processing
pipeline and vector processingpipeline and vector processing
pipeline and vector processingAcad
 
Branch and bound
Branch and boundBranch and bound
Branch and boundAcad
 
Classification and prediction
Classification and predictionClassification and prediction
Classification and predictionAcad
 
Structure and Typedef
Structure and TypedefStructure and Typedef
Structure and TypedefAcad
 
c and data structures first unit notes (jntuh syllabus)
c and data structures first unit notes (jntuh syllabus)c and data structures first unit notes (jntuh syllabus)
c and data structures first unit notes (jntuh syllabus)Acad
 
Association rule mining
Association rule miningAssociation rule mining
Association rule miningAcad
 

Viewers also liked (12)

Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
input output Organization
input output Organizationinput output Organization
input output Organization
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
Cluster analysis
Cluster analysisCluster analysis
Cluster analysis
 
Union from C and Data Strutures
Union from C and Data StruturesUnion from C and Data Strutures
Union from C and Data Strutures
 
Data retrieval in sensor networks
Data retrieval in sensor networksData retrieval in sensor networks
Data retrieval in sensor networks
 
pipeline and vector processing
pipeline and vector processingpipeline and vector processing
pipeline and vector processing
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Classification and prediction
Classification and predictionClassification and prediction
Classification and prediction
 
Structure and Typedef
Structure and TypedefStructure and Typedef
Structure and Typedef
 
c and data structures first unit notes (jntuh syllabus)
c and data structures first unit notes (jntuh syllabus)c and data structures first unit notes (jntuh syllabus)
c and data structures first unit notes (jntuh syllabus)
 
Association rule mining
Association rule miningAssociation rule mining
Association rule mining
 

Similar to Tiny os

MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system DesignAJAL A J
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer ArchitectureHaris456
 
What is SDN and how to approach it with Python
What is SDN and how to approach it with PythonWhat is SDN and how to approach it with Python
What is SDN and how to approach it with PythonJustin Park
 
Introduction to Computer & Operating Systems.ppt
Introduction to Computer & Operating Systems.pptIntroduction to Computer & Operating Systems.ppt
Introduction to Computer & Operating Systems.pptBakareAyeni1
 
wirelss sensor network
wirelss sensor networkwirelss sensor network
wirelss sensor networkrasyidi usman
 
ERU-2-wsn.ppt
ERU-2-wsn.pptERU-2-wsn.ppt
ERU-2-wsn.pptSahanaMk2
 
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...John Holmen
 
RTOS based Confidential Area Security System
RTOS based Confidential Area Security SystemRTOS based Confidential Area Security System
RTOS based Confidential Area Security Systemajinky gadewar
 

Similar to Tiny os (20)

Tos tutorial
Tos tutorialTos tutorial
Tos tutorial
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 
Wsn handbook
Wsn handbookWsn handbook
Wsn handbook
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 
TinyOS Course 00: Introduction to WSN
TinyOS Course 00: Introduction to WSNTinyOS Course 00: Introduction to WSN
TinyOS Course 00: Introduction to WSN
 
Nesc tutorial
Nesc tutorialNesc tutorial
Nesc tutorial
 
Ch04 threads
Ch04 threadsCh04 threads
Ch04 threads
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system Design
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
RTOS [Autosaved].pptx
RTOS [Autosaved].pptxRTOS [Autosaved].pptx
RTOS [Autosaved].pptx
 
Unit 2(oss) (1)
Unit 2(oss) (1)Unit 2(oss) (1)
Unit 2(oss) (1)
 
What is SDN and how to approach it with Python
What is SDN and how to approach it with PythonWhat is SDN and how to approach it with Python
What is SDN and how to approach it with Python
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Introduction to Computer & Operating Systems.ppt
Introduction to Computer & Operating Systems.pptIntroduction to Computer & Operating Systems.ppt
Introduction to Computer & Operating Systems.ppt
 
wirelss sensor network
wirelss sensor networkwirelss sensor network
wirelss sensor network
 
ERU-2-wsn.ppt
ERU-2-wsn.pptERU-2-wsn.ppt
ERU-2-wsn.ppt
 
ERU-2-wsn.ppt
ERU-2-wsn.pptERU-2-wsn.ppt
ERU-2-wsn.ppt
 
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...
PEARC17: Improving Uintah's Scalability Through the Use of Portable Kokkos-Ba...
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
 
RTOS based Confidential Area Security System
RTOS based Confidential Area Security SystemRTOS based Confidential Area Security System
RTOS based Confidential Area Security System
 

More from Acad

routing alg.pptx
routing alg.pptxrouting alg.pptx
routing alg.pptxAcad
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptxAcad
 
Computer Science basics
Computer Science basics Computer Science basics
Computer Science basics Acad
 
Union
UnionUnion
UnionAcad
 
Stacks
StacksStacks
StacksAcad
 
Str
StrStr
StrAcad
 
Functions
FunctionsFunctions
FunctionsAcad
 
File
FileFile
FileAcad
 
Ds
DsDs
DsAcad
 
Dma
DmaDma
DmaAcad
 
Botnet detection by Imitation method
Botnet detection  by Imitation methodBotnet detection  by Imitation method
Botnet detection by Imitation methodAcad
 
Bot net detection by using ssl encryption
Bot net detection by using ssl encryptionBot net detection by using ssl encryption
Bot net detection by using ssl encryptionAcad
 
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...Acad
 
Literature survey on peer to peer botnets
Literature survey on peer to peer botnetsLiterature survey on peer to peer botnets
Literature survey on peer to peer botnetsAcad
 
multi processors
multi processorsmulti processors
multi processorsAcad
 

More from Acad (15)

routing alg.pptx
routing alg.pptxrouting alg.pptx
routing alg.pptx
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
 
Computer Science basics
Computer Science basics Computer Science basics
Computer Science basics
 
Union
UnionUnion
Union
 
Stacks
StacksStacks
Stacks
 
Str
StrStr
Str
 
Functions
FunctionsFunctions
Functions
 
File
FileFile
File
 
Ds
DsDs
Ds
 
Dma
DmaDma
Dma
 
Botnet detection by Imitation method
Botnet detection  by Imitation methodBotnet detection  by Imitation method
Botnet detection by Imitation method
 
Bot net detection by using ssl encryption
Bot net detection by using ssl encryptionBot net detection by using ssl encryption
Bot net detection by using ssl encryption
 
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...
An Aggregate Location Monitoring System Of Privacy Preserving In Authenticati...
 
Literature survey on peer to peer botnets
Literature survey on peer to peer botnetsLiterature survey on peer to peer botnets
Literature survey on peer to peer botnets
 
multi processors
multi processorsmulti processors
multi processors
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Recently uploaded (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

Tiny os

  • 2. Learning Objectives • Understand TinyOS – the dominant open source operating systems for WSN – Hardware abstraction architecture (HAA) – TinyOS architecture and component model – Main characteristics of TinyOS 2 • Understand NesC programmng • Learn representative WSN applications
  • 3. Prerequisites • Module 1 • Basic concepts of Operating Systems • Basic concepts of Object-oriented Design and Analysis • Basic concepts of Computer Networks
  • 4. http://www.tinyos.net 4 Software Challenges - TinyOS • Power efficient – Put microcontroller and radio to sleep • Small memory footprint – Non-preemptable FIFO task scheduling • Efficient modularity – Function call (event and command) interface between commands • Application specific • Concurrency-intensive operation – Event-driven architecture – No user/kernel boundary
  • 5. [TinyOS_1]: Table 2 5 TinyOS Hardware Abstraction Architecture (HAA) • Section 2.3 and Figure 2.5 of J. Polastre Dissertation: http://www.polastre.com/papers/polastre-thesis-final.pdf
  • 6. TinyOS Hardware Abstraction Architecture (HAA) Ref: Figure 2.4 of J. Polastre Dissertation http://www.polastre.com/papers/polastre-thesis-final.pdf
  • 7. Traditional OS Architectures Problem with Large Scale Deeply embedded system.. • Large memory & storage requirement • Unnecessary and overkill functionality ( address space isolation, complex I/O subsystem , UI ) for our scenario. • Relative high system overhead ( e.g, context switch ) • Require complex and power consuming hardware support. VM I/O Scheduler Application 1 Application 2 Monolith-kernel HW NFS I/O Scheduler Application 1 Micro-kernel HW IPC VM
  • 8. NO Kernel Direct hardware manipulation NO Process management Only one process on the fly. NO Virtual memory Single linear physical address space NO Dynamic memory allocation Assigned at compile time NO Software signal or exception Function Call instead Goal: to strip down memory size and system overhead. TinyOS Architecture Overview (1) I/O COMM . ……. Scheduler TinyOS Application Component Application Component Application Component
  • 9. TinyOS Overview • Application = scheduler + graph of components – Compiled into one executable • Event-driven architecture • Single shared stack • No kernel/user space differentiation Communication Actuating Sensing Communication Application (User Components) Main (includes Scheduler) Hardware Abstractions
  • 10. [TinyOS_4] 10 TinyOS Component Model • Component has: – Frame (storage) – Tasks: computation – Interface: • Command • Event • Frame: static storage model - compile time memory allocation (efficiency) • Command and events are function calls (efficiency) Messaging Component Internal StateInternal Tasks Commands Events
  • 11. The mote revolution: Low Powr Wireless Sensor Network 12 Typical WSN Application • Periodic – Data Collection – Network Maintenance – Majority of operation • Triggered Events – Detection/Notification – Infrequently occurs • But… must be reported quickly and reliably • Long Lifetime – Months to Years without changing batteries – Power management is the key to WSN success sleep wakeup processing data acquisition communication Power Time
  • 12. The mote revolution: Low Powr Wireless Sensor Network 13 Design Principles • Key to Low Duty Cycle Operation: – Sleep – majority of the time – Wakeup – quickly start processing – Active – minimize work & return to sleep
  • 13. The mote revolution: Low Powr Wireless Sensor Network 14 Minimize Power Consumption • Compare to Mica2: a MicaZ mote with AVR mcu and 802.15.4 radio • Sleep – Majority of the time – Telos: 2.4mA – MicaZ: 30mA • Wakeup – As quickly as possible to process and return to sleep – Telos: 290ns typical, 6ms max – MicaZ: 60ms max internal oscillator, 4ms external • Active – Get your work done and get back to sleep – Telos: 4-8MHz 16-bit – MicaZ: 8MHz 8-bit
  • 15. Energy Consumption • Idle listen:receive:send = 1:1.05:1.4
  • 16. [Introduction_2]: Figure 3 17 TinyOS Radio Stack
  • 17. [Introduction_2]: Table 2 18 Code and Data Size Breakdown
  • 18. WSN Protocol Stack Ref: [Introduction_1] “A Survey on Sensor Networks,” IEEE Communications Magazine, Aug. 2002, pp. 102-114.
  • 19. TinyOS 2 • An operating system for tiny, embedded, and networked sensors • NesC language – A dialect of C Language with extensions for components • Three Limitations – Application complexity – High cost of porting to a new platform – reliability • Little more that a non-preemptive scheduler • Component-based architecture • Event-driven • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 20. TinyOS 2 • Static binding and allocation – Every resource and service is bound at compile time and all allocation is static • Single thread of control • Non-blocking calls – A call to start lengthy operation returns immediately – the called component signals when the operation is complete – Split phase – See this link for one example http://docs.tinyos.net/index.php/Modules_and_the_TinyOS_Exe • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks” • Ref: [TinyOS_3] Section 2.1
  • 21. TinyOS 2 • The scheduler has a fixed-length queue, FIFO • Task run atomically • Interrupt handlers can only call code that has the async keyword • Complex interactions among components • Event – In most mote applications, execution is driven solely by timer events and the arrival of radio messages • ATmega128 has two 8-bit timers and two 16-bit timers • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 22. TinyOS 2 • sync code is non-preemptive, – when synchronous (sync) code starts running, it does not relinquish the CPU to other sync code until it completes • Tasks – enable components to perform general-purpose "background" processing in an application – A function which a component tells TinyOS to run later, rather than now • The post operation places the task on an internal task queue which is processed in FIFO order • Tasks do not preempt each other • A Task can be preempted by a hardware interrupt • See TinyOS lesson: – Modules and the TinyOS Execution Model
  • 23. 802.15.4 and CC2420 • CC2420 hardware signals packet reception by triggering an interrupt • The software stack is responsible for reading the received bytes out of CC2420’s memory; • The software stack sends a packet by writing it to CC2420’s memory then sending a transmit command • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 24. TinyOS 2 • Platforms – MicaZ, Mica2, etc; – Compositions of chips • Chips – MCU, radio, etc – Each chip follows the HAA model, with a HIL implementation at the top • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 25. TinyOS 2 • A T2 packet has a fixed size data payload which exists at a fixed offset • The HIL of a data link stack is an active message interface • Zero-copy • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 26. Scheduler in TinyOS 2.x SchedulerBasicP.nc of TinyOS 2.x
  • 27. TinyOS Serial Stack • Ref: P. Levis, et al. “T2: A Second Generation OS For Embedded Sensor Networks”
  • 28. Device Drivers in T2 • Virtualized • Dedicated • Shared • Ref: Section 3 of [Energy_1]
  • 29. [TinyOS_1]: Section 5 30 T2 Timer Subsystem • MCU comes with a wide variation of hardware timers – ATmega128: two 8-bit timers and two 16-bit times – MSP430: two 16-bit timers • Requirement of Timer subsystem – Different sampling rates: one per day to 10kHz
  • 30. T2 Timer Subsystem • See interface at: – tos/lib/timer/Timer.nc
  • 31. One Example TinyOS Application - BlinkC • http://docs.tinyos.net/index.php/TinyOS_Tutor ials
  • 32. One Example of Wiring • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 33. AppM • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 34. AppM • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 35. Sensor Interface • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 36. Initialize Interface • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 37. SensorC • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 38. AppC • Ref: D. Gay, et al. “Software Design Patterns for TinyOS”
  • 41. Parameterized Interfaces • An interface array •Ref: D. Gay, et al. “Software Design Patterns for TinyOS”, Section 2.3
  • 42. unique and uniqueCount • Want to use a single element of a parameterized interface and does not care which one, as long as no one else use it • Want to know the number of different values returned by unique •Ref: D. Gay, et al. “Software Design Patterns for TinyOS”, Section 2.4
  • 43. section 4.5 "TinyOS Programming manual" 44 async • Functions that can run preemptively are labeled with async keyword • Command an async function calls and events an async function signals must be async • All interrupt handlers are async • atomic keyword – Race conditions, data races
  • 44. Generic Components and Typed Interface • Have at least one type parameter • Generic Components are NOT singletons – Can be instantiated within an configuration – Instantiated with the keyword new (Singleton components are just named)
  • 45. /tos/lib/timer/VirtualizeTimerC.n 46 Example - VirtualizeTimerC • Use a single timer to create up to 255 virtual timers • generic module VirtualizeTimerC(typedef precision_tag, int max_timers) • Precision_tag: A type indicating the precision of the Timer being virtualized • max_timers: Number of virtual timers to create. • How to use it? – Components new VirtualizeTimerC(TMilli, 3) as TimerA • This will allocate three timers – Components new VirtualizeTimerC(TMilli, 4) as TimerB • This will allocate three timers • Ref: – /tos/lib/timer/VirtualizeTimerC.nc – Section 7.1 of “TinyOS Programming Manual”
  • 47. Figure 4 of [TinyOS_1] 48 Timer Stack on MicaZ/Mica2
  • 48. Timer Subsystem • HplTimer[0-3]C provide dedicated access to the two 8-bit and two 16-bit timers of ATmega128 MCU • T2 subsystem is built over the 8-bit timer 0 • Timer 1 is used for CC2420 radio
  • 49. message_t • tos/types/message.h • Ref. TEP 111 • Every link layer defines its header, footer, and metadata structures
  • 50. Relationship between CC1000 Radio Implementation and message_t • tos/chips/cc1000/CC1000Msg.h
  • 51. Relationship between CC2420 Radio Implementation and message_t • tos/chips/cc2420/CC2420.h
  • 52. Relationship between Serial Stack Packet Implementation and message_t • tinyos-2.x/tos/lib/serial/Serial.h
  • 53. Active Message (AM) • Why do we need AM? – Because it is very common to have multiple services using the same radio to communicate – AM layer to multiplex access to the radio • make micaz install,n – n: unique identifier for a node
  • 54. Active Message • Every message contains the name of an event handler • Sender – Declaring buffer storage in a frame – Naming a handler – Requesting Transmission – Done completion signal • Receiver – The event handler is fired automatically in a target node  No blocked or waiting threads on the receiver  Behaves like any other events  Single buffering  Double Check!!!!!!!
  • 55. TinyOS Component • Two types of components – Module: provide implementations of one or more interfaces – Configuration: assemble other components together
  • 56. TinyOS Component Model • Component has: – Frame (storage) – Tasks: computation – Interface: • Command • Event • Frame: static storage model - compile time memory allocation (efficiency) • Command and events are function calls (efficiency) Messaging Component Internal StateInternal Tasks Commands Events
  • 57. Structure of a Component TinyOS Component Command Handlers Event Handlers Set of Tasks Frame (containing state information)
  • 58. TinyOS Two-level Scheduling • Tasks do computations – Non-preemptable FIFO scheduling – Bounded number of pending tasks • Events handle concurrent dataflows – Interrupts trigger lowest level events – Events prempt tasks, tasks do not – Events can signal events, call commands, or post tasks Hardware Interrupts events commands FIFO Tasks POST Preempt Time commands
  • 59. TinyOS Applications • In most mote applications, execution is driven solely by timer events and the arrival of radio messages
  • 60. How to Program motes Under TinyOS • make telosb install,n mib510,/dev/ttyUSB0 • make telosb install,1 mib510,/dev/ttyUSB0
  • 61. Representative WSN Applications • BaseStation – Listen – BlinkToRadio – One-hop WSN application to collect sensed values • OscilloScope – one-hop WSN application with GUI interface • MultiOscilloScopre – multihop WSN application • Octopus – multi-hop WSN application with a more dynamic display of network topology and data dissemination functions
  • 62. Application Example - BaseStation, Listen and BlinkToRadio
  • 63. Application Example - Oscilloscope
  • 66. MViz
  • 67. Application Example - Octopus • http://csserver.ucd.ie/~rjurdak/Octopus.htm
  • 69. BaseStation – Listen - BlinkToRadio
  • 72. MViz
  • 74. Lab 1 • a) Write a PingPong application that runs on two nodes. When a node boots, it sends a broadcast packet using the AMSend interface. When it receives a packet, it a) wait one second; b) sends a packet; c) toggle an LED whenever a node sends a packet.
  • 75. Lab 2 • b) Please add the reliable data transmission feature to the PingPong application from the Application and Link layer, respectively. Suppose that two motes A and B are talking to each other. I. Application Layer: When mote A sends a broadcast pack P to node B, mote A will start a timer T. When mote B receives the packet P, mote B will send an ACK to node A. b.1 If the timer T expires before mote A receives the ACK from mote B (either the packet P or the ACK is lost), mote A will retransmit the packet; b.2 If mote A receives the ACK from mote B before the timer T expires, mote A will do nothing when the timer T expires. b.3 If mote B receive a packet which has already been received (based on sequence number), node B just drop this packet. There is a sequence number included in the payload of the packet P. The sequence number starts from 0. When a packet P is received, the receiver will display the bottom three bits (through LEDs) of the sequence number in the packet P.
  • 76. Lab 2 - continue • II. Link Layer: In TEP 126 (http://www.tinyos.net/tinyos- 2.x/doc/html/tep126.html), it says: “PacketLink: This layer provides automatic retransmission functionality and is responsible for retrying a packet transmission if no acknowledgement was heard from the receiver. PacketLink is activated on a per-message basis, meaning the outgoing packet will not use PacketLink unless it is configured ahead of time to do so” Therefore, as an alternative, you may also configure PacketLink to provide automatic retransmission functionality.
  • 77. Assignment • 1. What is the relationship among all the application components in the Oscilloscope application? • 2. please give two examples of split-phase operations in TinyOS 2. • 3. What is the usage of Active Message in TinyOS 2? • 4. Why doesn’t TinyOS 2 make every statement async?

Editor's Notes

  1. Every one of these state machine based components has three major pieces. They include a storage frame, a set of tasks that they can request to be scheduled and a description of their interface. This description not only contains the interface for people using this component, but it also contains the interface for , it also describes the interface that needs to be implemented by supporting components.
  2. In hand held devices do you really choose weather or not to have the display active or communication take place. A user dictates the requirements and the system’s only choice is how to meet those demands with the available resources.
  3. Every one of these state machine based components has three major pieces. They include a storage frame, a set of tasks that they can request to be scheduled and a description of their interface. This description not only contains the interface for people using this component, but it also contains the interface for , it also describes the interface that needs to be implemented by supporting components.
  4. Events preempt tasks, tasks do not Events can signal events or call commands Commands don’t signal events Either can post tasks