Systems Wireless EmBedded nesC Update Eric Brewer with help from David Culler, David Gay, Phil Levis, Rob von Behren, and Matt Welsh.

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

NesC Prepared for the Multimedia Networks Group University of Virginia.
NesC: A Programming Language for Motes David Gay, Phil Levis, Eric Brewer, Rob von Behren, Nikita Borisov, Mike Chen, David Culler Intel Research, UC Berkeley.
The nesc Language: A Holistic Approach to Networked Embedded Systems David Gay, Philip Levis, Robert von Behren, Matt Welsh, Eric Brewer, David Culler.
Sensor Network Platforms and Tools
Using DSVM to Implement a Distributed File System Ramon Lawrence Dept. of Computer Science
Towards a Model Checker for NesC and Wireless Sensor Networks Manchun Zheng 1, Jun Sun 2, Yang Liu 1, Jin Song Dong 1, and Yu Gu 2 1 National University.
The TinyOS of Tomorrow Phil Levis NEST Retreat, Jan
Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider.
Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Extensibility, Safety and Performance in the SPIN Operating System Brian Bershad, Stefan Savage, Przemyslaw Pardyak, Emin Gun Sirer, Marc E. Fiuczynski,
1 Efficient Memory Safety for TinyOS Nathan Cooprider Will Archer Eric Eide David Gay † John Regehr University of Utah School of Computing † Intel Research.
How to Code on TinyOS Xufei Mao Advisor: Dr. Xiang-yang Li CS Dept. IIT.
Sample Project Ideas KD Kang. Project Idea 1: Real-time task scheduling in TinyOS EDF in TinyOS 2.x –Description is available at
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Memory Management 2010.
Lock Inference for Systems Software John Regehr Alastair Reid University of Utah March 17, 2003.
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
Development of a Mica2 Mote Sensor Network Cliff Macklin Bill Ehrbar December 8, 2004 University of Colorado, Colorado Springs.
Systems Wireless EmBedded Macroprogramming Eric Brewer (with help from David Gay, Rob von Behren, and Phil Levis)
Chapter 3.7 Memory and I/O Systems. 2 Memory Management Only applies to languages with explicit memory management (C or C++) Memory problems are one of.
1 Organization of Programming Languages-Cheng (Fall 2004) Concurrency u A PROCESS or THREAD:is a potentially-active execution context. Classic von Neumann.
The Structure of the “THE” -Multiprogramming System Edsger W. Dijkstra Jimmy Pierce.
NesC: 1.1 Bumps and Future Directions David Gay, Intel Research, Berkeley (and the nesC and TinyOS teams)
1 Software Development Infrastructure for Sensor Networks  Operating systems ( TinyOS )  Resource (device) management  Basic primitives  Protocols.
The nesC Language: A Holistic Approach to Networked Embedded Systems Tony Chen April 29, 2003.
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.
TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
1 Efficient Type and Memory Safety for Tiny Embedded Systems John Regehr Nathan Cooprider Will Archer Eric Eide University of Utah School of Computing.
Korea Advanced Institute of Science and Technology Active Sensor Networks(Mate) (Published by Philip Levis, David Gay, and David Culler in NSDI 2005) 11/11/09.
Dhanshree Nimje Smita Khartad
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
Himali Saxena. Topics Configurations and Wiring Configuration implementation Basic Rules for declaration/definition Auto Wiring initialization ‘C’ and.
Main Issues Three major issues that we are concerned with in sensor networks are – Clustering Routing and Security To be considered against the backdrop.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
Object-Oriented Programming Chapter Chapter
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization.
LECTURE 19 Subroutines and Parameter Passing. ABSTRACTION Recall: Abstraction is the process by which we can hide larger or more complex code fragments.
Big Picture Lab 4 Operating Systems C Andras Moritz
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
The Structuring of Systems Using Upcalls By David D. Clark Presented by Samuel Moffatt.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
CSE 120 Principles of Operating
Simulation of Distributed Application and Protocols using TOSSIM
Lecture 25 More Synchronized Data and Producer/Consumer Relationship
An Introduction to nesC
Background and Motivation
Chapter 2: Operating-System Structures
Introduction to Operating Systems
CSE 451: Operating Systems Autumn 2004 Module 6 Synchronization
CSE 451: Operating Systems Autumn 2003 Lecture 7 Synchronization
CSE 451: Operating Systems Autumn 2005 Lecture 7 Synchronization
CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization
CSE 153 Design of Operating Systems Winter 19
Foundations and Definitions
Chapter 2: Operating-System Structures
Presentation transcript:

Systems Wireless EmBedded nesC Update Eric Brewer with help from David Culler, David Gay, Phil Levis, Rob von Behren, and Matt Welsh

Systems Wireless EmBedded 1/15/2003NEST Retreat2 Language Goals Short term (NesC) –Make it much easier to program single motes –Gain experience with the issues (please tell us!) –Build intermediate language for future work Long term (macroprogramming) –Write high-level programs for groups of motes –Deal with failure and uncertainty, varying numbers of motes –Abstract issues of time, location, neighbors –Provide implicit communication and data sharing –Enable low power and bandwidth efficiency Apply outside of TinyOS (?)

Systems Wireless EmBedded 1/15/2003NEST Retreat3 Completed Goals [from June] Easier coding and better code size Definition of messages –Define a message type and then create surrounding code Big goal: race-free, deadlock-free programs (done!) Documentation Tool

Systems Wireless EmBedded 1/15/2003NEST Retreat4 Principles C Like Whole-program analysis –Enforce global properties (e.g. no races) –Optimization “static language” –no malloc, no function pointers Support TinyOS: components and events

Systems Wireless EmBedded 1/15/2003NEST Retreat5 Abstract Components Multiple instances of the same component: components AMHandler(38) as commandHandler, AMHandler(45) as dataHandler; abstract module QueuedSend(int maxAttempts){...} configuration Multihop { provides interface Send; } implementation { components MultihopM, QueuedSend(10) as newQueue,... ; Send = MultihopM.Send; MultihopM.QueuedSendMsg -> newQueue.Send;... }

Systems Wireless EmBedded 1/15/2003NEST Retreat6 Multi-client services? Example: timer service with different intervals for different clients How to manage the shared state of the service? –Abstract components: »State is private »Added a way to name other instances state… –Parameterized components: »Parameter is client ID – have to statically allocate »Still awkward… –Other ways??

Systems Wireless EmBedded 1/15/2003NEST Retreat7 Optimization Whole-program analysis Code size reduction: –Dead code elimination = 9% –Inlining = 16% –25% total Performance: –About the same –Inlining surprisingly not helpful

Systems Wireless EmBedded 1/15/2003NEST Retreat8 Data Races Key idea: detect sharing, enforce atomicity Two kinds of contexts: –Interrupts: run any time –Tasks: scheduled, run to completion »Code is atomic relative to other tasks Any code that is reachable from an interrupt is “interrupt context” Key invariant: –“atomic section” for anything shared with an interrupt context –We detect context statically, then enforce the invariant.

Systems Wireless EmBedded 1/15/2003NEST Retreat9 Atomic Sections atomic { } We ensure it will be atomic. Restrictions: –No loops –No yields (or blocking calls in the future) –No commands/events –Calls OK, but callee must meet restrictions Easy to use in practice!

Systems Wireless EmBedded 1/15/2003NEST Retreat10 Example event result_t Timer.fired() { bool localBusy; atomic { localBusy = busy; busy = TRUE; } if (!localBusy) call ADC.getData(); return SUCCESS; }

Systems Wireless EmBedded 1/15/2003NEST Retreat11 Results Tested on full TinyOS tree, plus applications –186 modules (121 modules, 65 configurations) –20-69 modules/app, 35 average –17 tasks, 75 events on average (per app) »Lots of concurrency! Found 156 races: 103 real (!) –About 6 per 1000 lines of code –53 false positives Fixing races: –Add atomic sections –Post tasks (move code to task context)

Systems Wireless EmBedded 1/15/2003NEST Retreat12 False Positives Three Categories –State-based guards »If (state = x) update foo »State check prevents race Probably good to still use atomic –Buffer swaps »Parent/child alternate ownership Hidden protocol for sharing »Could remove this class with “pass” –Causal Relationships »Conflicting code segments are both runnable at the same time »E.g., task runs only after timer interrupt

Systems Wireless EmBedded 1/15/2003NEST Retreat13 Tools “norace” keyword –Use to remove false positives “interrupt” keyword –Means that it is OK to execute command/event in interrupt context –Claim: people should know when code runs via interrupts Compile-time errors –Potential races »Fix: atomic, post or norace –Unexpected interrupt context »Fix: change to task, or add ‘interrupt’ keyword

Systems Wireless EmBedded 1/15/2003NEST Retreat14 Still can have races… Basic pattern: –Read in one atomic section, write in another atomic { Tmp = x; } … tmp = f(tmp); … atomic { x = tmp; }

Systems Wireless EmBedded 1/15/2003NEST Retreat15 NesC Future Work Simplify split-phase calls –Blocking calls at the higher level? –At least simplify creation of the command/event pair »Reduce false positives? –Manage state across split-phase calls “pass” values (like message buffer) –Pass by reference, but object leaves your scope –Implies passed thing is NOT shared –Simplifies capabilities, events, pipelines –Helps the “buffer swap” case »Reduces false positives

Systems Wireless EmBedded 1/15/2003NEST Retreat16 NesC Future Work Dynamic Linking? –Enable larger programs, multi-mode motes –Load modules from EEPROM? from network? Scheduling? –There is one simple scheduler with no knobs… Sleep modes/timing? Explicit support for state machines? –Would reduce false positives –Lot of modules have state, this would simplify them…

Systems Wireless EmBedded 1/15/2003NEST Retreat17 Conclusions Significant progress! Better code, faster development Fewer errors –Race detection –Wiring errors –Interfaces Code size down 25% Message tool (mig) done Doc tool done Concurrency checking works