Vishal Jain, 200411029 1.1 TinyOS Design Viewpoint “TinyOS” Design Viewpoint.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

Interactive lesson about operating system
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Sensor Network Platforms and Tools
Overview: Chapter 7  Sensor node platforms must contend with many issues  Energy consumption  Sensing environment  Networking  Real-time constraints.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
How to Code on TinyOS Xufei Mao Advisor: Dr. Xiang-yang Li CS Dept. IIT.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
Sample Project Ideas KD Kang. Project Idea 1: Real-time task scheduling in TinyOS EDF in TinyOS 2.x –Description is available at
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
3.5 Interprocess Communication
OS Spring’03 Introduction Operating Systems Spring 2003.
TinyOS Software Engineering Sensor Networks for the Masses.
Chapter 11 Operating Systems
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization.
By: R Jayampathi Sampath
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 1 Introduction Read:
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 1: Introduction What Operating Systems Do Computer-System.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Operating System Principles And Multitasking
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Review for Quiz-2 Applied Operating System Concepts Chap.s 1,2,6,7 - ECE3055b, Spring 2005.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
System Architecture Directions for Networked Sensors.
CS4315A. Berrached:CMS:UHD1 Introduction to Operating Systems Chapter 1.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
Introduction to Operating Systems Concepts
OPERATING SYSTEM CONCEPT AND PRACTISE
Applied Operating System Concepts
Processes and threads.
Simulation of Distributed Application and Protocols using TOSSIM
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 1: Introduction
Real-time Software Design
Chapter 1: Intro (excerpt)
What is an Operating System?
Module 2: Computer-System Structures
Operating System Concepts
Lecture Topics: 11/1 General Operating System Concepts Processes
Introduction to Operating Systems
Architectural Support for OS
Introduction to Operating Systems
Module 2: Computer-System Structures
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Operating System Concepts
Modeling Event-Based Systems in Ptolemy II EE249 Project Status Report
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Vishal Jain, TinyOS Design Viewpoint “TinyOS” Design Viewpoint

Vishal Jain, TinyOS Design Viewpoint Index What is Sensor Network? Traditional Stuff  What is an Operating System?  System Component  OS definitions Motes : Take a deep Look Sensor Network Design Factors Why new OS? TinyOS Features  Component-based architecture  Tasks and event-based concurrency  Split-phase operations  Scheduler  Frames Composition Model Examples  Surge : Given in Paper  Oil Exploration : Let us try Review Technical Details Exercises

Vishal Jain, TinyOS Design Viewpoint Goals of Presentation To give knowledge about Sensor Network To view application from component viewpoint To implement system by designing components and wiring them together to have an application To know about concurrency: Tasks and events To know data races and program inlining concepts To learn about active messages To tryout design of Application. …………………………

Vishal Jain, TinyOS Design Viewpoint Non Goals To write program in nesC To upload it in Motes and run it. To really setup an sensor Network

Vishal Jain, TinyOS Design Viewpoint What is Sensor Network? A sensor network consist of many spatially synchronized distributed sensors, which are used to monitor or detect changes of a phenomena at different locations(say temperature change, pollutant level etc). Sensor nodes(motes) may have onboard processor to process the raw data.

Vishal Jain, TinyOS Design Viewpoint What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals:  Execute user programs and make solving user problems easier.  Make the computer system convenient to use. Use the computer hardware in an efficient manner.

Vishal Jain, TinyOS Design Viewpoint System Components 1.Hardware – provides basic computing resources (CPU, memory, I/O devices). 2.Operating system – controls and coordinates the use of the hardware among the various application programs for the various users. 3.Applications programs – define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4.Users (people, machines, other computers).

Vishal Jain, TinyOS Design Viewpoint Abstract View of System Components

Vishal Jain, TinyOS Design Viewpoint Operating System Definitions Resource allocator – manages and allocates resources. Control program – controls the execution of user programs and operations of I/O devices. Kernel – the one program running at all times (all else being application programs).

Vishal Jain, TinyOS Design Viewpoint Take a Deep Look Into Motes Motes are very small and interact with environment Run specific application Limited resources and all resources known in advance Hardware software boundaries are system and application dependent. Motes are Event Driven Reliability of motes is important because they are unattended. Soft real time requirement.

Vishal Jain, TinyOS Design Viewpoint Sensor Network Design Factors Design Factors F Fault Tolerance F Scalability F Production Costs F Resource Constraints F Sensor Network Topology F Environment F Transmission Media F Power Consumption

Vishal Jain, TinyOS Design Viewpoint Why New Operating System?

Vishal Jain, TinyOS Design Viewpoint TinyOS: Features Simple component based OS  Subset of Components used for application specific functionality Maintains high level of concurrency in a limited space Uses power efficiently  Spending unused CPU cycles in sleep  Turning radio off when not in use Programming Model  Reactive to environment  Concurrency  Communication nesC is suitably design to support all above. (    sorry wait for next talk on detailed nesC programming.)

Vishal Jain, TinyOS Design Viewpoint TinyOS: Components Components: Reusable piece of code. Provides and uses interfaces. Interface :interfaces are the only point of access to the component. Interfaces in TinyOS are bi-directional: they contain commands and events The providers of an interface implement the commands, while the users implements the events. downward-pointing arrows depict commands and upward-pointing arrows depict events.

Vishal Jain, TinyOS Design Viewpoint Example Component Fired event Start command Stop command Init command Fire event Setrate() command

Vishal Jain, TinyOS Design Viewpoint TinyOS: Wiring the Components An application connects components using a wiring specification that is independent of component implementations. Fan-out : a single command call expression may be connected to an arbitrary number of command implementations. Fan in : an arbitrary number of command call expressions may be wired to a single command implementation.

Vishal Jain, TinyOS Design Viewpoint What is Concurrency? n On a single-processor machine, the operating system’s support for concurrency allows multiple tasks to share resources in such a way that tasks appear to run at the same time. n Advantages F be able to run multiple applications at the same time. F better resource utilization F better average response time of individual applications n Disadvantages F Multiple applications need to be protected from one another. F Multiple applications may need to coordinate through additional mechanisms F Switching among applications requires additional performance overheads

Vishal Jain, TinyOS Design Viewpoint Concurrency : Terms and Def.

Vishal Jain, TinyOS Design Viewpoint TinyOS: Concurrency Tasks and Event There are two sources of concurrency in TinyOS:  Tasks  Events Tasks are a deferred computation mechanism. They run to completion and do not preempt each other. Components can post tasks; the post operation immediately returns, deferring the computation until the scheduler executes the task later. Components can use tasks when timing requirements are not strict. Example: Packet Transmission  Example: task send_data(){//code of send data} ……………. post send_data()

Vishal Jain, TinyOS Design Viewpoint TinyOS: Tasks and event-based concurrency……. Events also run to completion, but may preempt the execution of a task or another event. Events signify either completion of a split-phase operation (discussed below) or an event from the environment (e.g. message reception or time passing). TinyOS execution is ultimately driven by events representing hardware interrupts.

Vishal Jain, TinyOS Design Viewpoint Concurrency and Atomicity Asynchronous Code (AC): code that is reachable from at least one interrupt handler. Synchronous Code (SC): code that is only reachable from tasks. Invariant: Synchronous Code is atomic with respect to other Synchronous Code.

Vishal Jain, TinyOS Design Viewpoint Concurrency and Atomicity Claim 1: Any update to shared state from AC is a potential. race condition. Claim 2: Any update to shared state from SC that is also updated from AC is a potential race condition. Race-Free Invariant : Any update to shared state is either not a potential race condition (SC only), or occurs within an atomic section. Tools : atomic sections and tasks.

Vishal Jain, TinyOS Design Viewpoint Split Phase All long-latency operations are split-phase: operation request and completion are separate functions. Commands are typically requests to execute an operation.If the operation is split-phase, the command returns immediately and completion will be signaled with an event;

Vishal Jain, TinyOS Design Viewpoint Scheduler Constrained two-level scheduling model: tasks + events Tasks have lower priority  Tasks cannot preempt other tasks or events FIFO scheduler Priority/ deadline based?  May be added, depends on your application Power aware  Processor sleeps when task queue empty

Vishal Jain, TinyOS Design Viewpoint Frames Internal storage Fixed Size  Memory requirement known at compile time  Static Allocation  Prevents Overheads Example  State of a component  Packet to be sent

Vishal Jain, TinyOS Design Viewpoint How should network msg be handled? Socket/TCP/IP?  Too much memory for buffering and threads  Data buffered in network stack until application threads read it.  Application threads blocked until data is available  Transmit too many bits (sequence #, ack, re-transmission)  Tied with multi-threaded architecture TinyOS solution: active messages

Vishal Jain, TinyOS Design Viewpoint Active Message Every message contains the name of an event handler  Sender: split-phase operation  Phase I – Declaring buffer storage in a frame – Naming a handler – Requesting Transmission; exit  Phase II – Done completion signal  Receiver  Event handler is called when message is received No blocked or waiting threads on sender or receiver Behaves like any other events Reduce buffering

Vishal Jain, TinyOS Design Viewpoint The Composition Model Components .comp: specification .C: behaviour .desc: select and wire specification:  accepts commands  uses commands  signals events  handles events comp1: C code comp3 comp4 comp2:.desc application:.desc

Vishal Jain, TinyOS Design Viewpoint Solved Example: Surge Problem Statement: n Surge, a simple application that performs periodic sensor sampling and uses ad-hoc multi-hop routing over the wireless network to deliver samples to the base station.Surge motes organize themselves into a spanning tree rooted at the base station. n Each mote maintains the address of its parent and its depth in the tree, advertising its depth in each radio message n Once a second, each mote samples its light sensor and sends the sample to its parent. n Parents acknowledge received packets. Surge uses the acknowledgments to provide a reliable transport layer.

Vishal Jain, TinyOS Design Viewpoint Surge Graph of Components

Vishal Jain, TinyOS Design Viewpoint Example Component Fired event Start command Stop command Init command Fire event Setrate() command

Vishal Jain, TinyOS Design Viewpoint Configuration

Vishal Jain, TinyOS Design Viewpoint Let Us Try One: Oil Exploration Our Role to Get TinyOS Application

Vishal Jain, TinyOS Design Viewpoint How People are Locating? n The steps in finding oil are similar throughout the world. n Creating seismic profiles in a suspected oil field, a charge or “shot” is set off that produces waves. The waves will then reflect differently on diverse rock strata. The waves are reflected back to the surface and recorded using geophones, which then translates the information into seismograms.

Vishal Jain, TinyOS Design Viewpoint Seismic Profile

Vishal Jain, TinyOS Design Viewpoint Let Us Design Application Let us take very simple Model: Problem Statement Sending of acoustic signal by Base Station about the Blasting. Collection of data when Blasting is done. Transmission of data using wireless multihop routing. Calculation of “Golden Vectors” by base station for each node. Sending “Golden Vector” information to all nodes. Relocation of motes in the direction of “Golden Vector” Inform about positions after relocation.

Vishal Jain, TinyOS Design Viewpoint Components Acoustic Sesmic Multihop Timer Golden_Vector Relocation Oil Relocation Golden_Vector Acoustic Multihop Timer clock HWclock Timer Receive SendMsg ADC2 Reloc

Vishal Jain, TinyOS Design Viewpoint Let us Specify Golden Vector Golden_Vector Receive StdCtl HWRec Get_GV Got_GV New_GV GV_Chang

Vishal Jain, TinyOS Design Viewpoint Evaluation of TinyOS:Components Component Model  Code can be divided into two  Application Specific  Core (172 components=108code+64 confg)

Vishal Jain, TinyOS Design Viewpoint Evaluation of TinyOS:Concurrency Concurrency  Simple tasks and events statements that implements concurrency by calling interrupts.

Vishal Jain, TinyOS Design Viewpoint Evaluation of TinyOS: Optimization Inlining

Vishal Jain, TinyOS Design Viewpoint References Main Paper  The nesC Language:A holistic approach to NES Core References: Sensor Network  TinyOS  OS  Galvin : OS concepts nesC  Oil Exploration  troleum.pdf

Vishal Jain, TinyOS Design Viewpoint Thanks for Patience….. Next Talk : “NesC : Programming” Ask Questions* *No Programming Questions Please What? How?