Bugs in the Wires or, An Exercise in Language Design David Gay Intel Research Berkeley.

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

Applications of Synchronization Coverage A.Bron,E.Farchi, Y.Magid,Y.Nir,S.Ur Tehila Mayzels 1.
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.
Telecooperation/RBG Technische Universität Darmstadt Copyrighted material; for TUD student use only Introduction to Computer Science I Topic 16: Exception.
Programming Types of Testing.
Introduction to BizAgi. Slide 2 User Interface (Summary) The user interface for BizAgi resembles Office It uses a similar ribbon The Palette contains.
TinyOS Introduction Advanced Computer Networks. TinyOS Outline  Introduction to the Architecture of TinyOS and nesC  Component Model –Components, interfaces,
Systems Wireless EmBedded nesC Update Eric Brewer with help from David Culler, David Gay, Phil Levis, Rob von Behren, and Matt Welsh.
1 Efficient Memory Safety for TinyOS Nathan Cooprider Will Archer Eric Eide David Gay † John Regehr University of Utah School of Computing † Intel Research.
Incremental Network Programming for Wireless Sensors NEST Retreat June 3 rd, 2004 Jaein Jeong UC Berkeley, EECS Introduction Background – Mechanisms of.
GIIS’07 – Marrakech 3 rd July 2007 Behavioural Specification of Wireless Sensor Network Applications Nelson S Rosa and Paulo R F Cunha Universidade Federal.
16-Jun-15 Exceptions. Errors and Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null.
7/13/2007AIIT Summer Course - D#1 Wireless Embedded Systems and Networking Lab Day 5: Part 1: TinyOS Programming on Open Source Distribution Jaein Jeong.
Random Testing of Interrupt-Driven Software John Regehr University of Utah.
Exceptions. Errors and Exceptions An error is a bug in your program –dividing by zero –going outside the bounds of an array –trying to use a null reference.
Programming Motes A TinyOS and TOSSIM Tutorial By: Brent Rood.
Development of a Mica2 Mote Sensor Network Cliff Macklin Bill Ehrbar December 8, 2004 University of Colorado, Colorado Springs.
Modules in UHC A proposal by: Tom Hofte & Eric Eijkelenboom.
2008EECS Embedded Network Programming nesC, TinyOS, Networking, Microcontrollers Jonathan Hui University of California, Berkeley.
TOSSIM: Visualizing the Real World Philip Levis, Nelson Lee, Dennis Chi and David Culler UC Berkeley NEST Retreat, January 2003.
NesC: 1.1 Bumps and Future Directions David Gay, Intel Research, Berkeley (and the nesC and TinyOS teams)
.NET Mobile Application Development Remote Procedure Call.
TITLE OF YOUR PROJECT. INTRODUCTION Type here about your science fair project Why you are interested in working on this idea. Why you think your project.
Struts 2.0 an Overview ( )
TinyOS 2.1 Jun Yi Partially based on the tutorial at IPSN 2009 By Stephen Dawson-Haggerty, Omprakash Gnawali, David Gay, Philip Levis, Răzvan Musăloiu-E.,
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
1 Software Development Infrastructure for Sensor Networks  Operating systems ( TinyOS )  Resource (device) management  Basic primitives  Protocols.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Programming in nesC (and TOSSIM)
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.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Data Analysis in YouTube. Introduction Social network + a video sharing media – Potential environment to propagate an influence. Friendship network and.
CSCI 6962: Server-side Design and Programming Web Services.
Learning objectives By the end of this lecture you should be able to:  have a well-earned rest! Ch 24 Beyond the second semester.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop.
Lab 3 Introduction to TinyOS and nesC How to debug programs at PC Examples –Blink Timer –Blink –Hellow World Reference: 1.x/doc/tutorial/lesson1.html.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
Debugging Strategies from Software Carpentry. Agan's Rules Many people make debugging harder than it needs to be by: Using inadequate tools Not going.
@ nesC Programming KETI / Ubiquitous Computing Center Jeonghoon Kang
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
Copyright © Curt Hill The IF Revisited If part 4 Style and Testing.
Lab 3, Part 2 Selected slides from: Wireless Sensor Networks Hardware/Software Tiny OS & NesC Programming borrowed from Turgay Korkmaz.
Active Message Application: CONNECT Presented by Xiaozhou David Zhu Oommen Regi July 6, 2001.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Lab1: LED Control ZigbeX mote has Red, Yellow, Green LED. This lab using LED control component provided by TinyOS.
Blink Blink.nc configuration Blink { } implementation { components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> BlinkM.StdControl; Main.StdControl.
1 Programming and problem solving in C, Maxima, and Excel.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
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.
Tinyos Introduction to Programming Pritee Parwekar.
Simulation of Distributed Application and Protocols using TOSSIM
Dr.K.Venkata Subba Reddy Professor-CSE Department
Testing and Debugging.
David Gay Intel Research Berkeley
Structural testing, Path Testing
Exceptions 10-Nov-18.
An Introduction to nesC
BugHint: A Visual Debugger Based on Graph Mining
Exceptions 10-May-19.
Presentation transcript:

Bugs in the Wires or, An Exercise in Language Design David Gay Intel Research Berkeley

Introduction Observation 1: debugging sensor network programs is hard Observation 1: debugging sensor network programs is hard Observation 2: nesC makes wiring, i.e., connecting components of a nesC program, easy; this also means that it’s easy to miswire Observation 2: nesC makes wiring, i.e., connecting components of a nesC program, easy; this also means that it’s easy to miswire example 1: forgetting to wire initialisation code example 1: forgetting to wire initialisation code example 2: mistakenly wiring components together twice example 2: mistakenly wiring components together twice Goal: add a simple language extension to catch these kinds of errors Goal: add a simple language extension to catch these kinds of errors

Background: Modules and Wiring module BlinkM { provides interface Init; provides interface Init; uses interface Timer; uses interface Timer;} implementation { command Init.init() { command Init.init() { call Timer.setRate(); call Timer.setRate(); } event Timer.fired() { } event Timer.fired() { }} interface Init { command init(); command init();} interface Timer { command setRate(); command setRate(); event fired(); event fired();} Interfaces are bi-directional. BlinkM can call setRate and must implement init and fired. BlinkM Init.init Timer.fired Timer.setRate C functions function calls

Background: Configurations configuration Blink { provides interface Init; provides interface Init;} implementation { components TimerM, BlinkM; components TimerM, BlinkM; Init = BlinkM.Init; Init = BlinkM.Init; BlinkM.Timer -> TimerM.Timer; BlinkM.Timer -> TimerM.Timer;} interface Init { command init(); command init();} Init.init Blink interface Timer { command setRate(); command setRate(); event fired(); event fired();} TimerM Timer.fired BlinkM Init.init Timer.fired Timer.setRate

Wiring Graph is Very Flexible Can build nearly arbitrary graphs, except: Can build nearly arbitrary graphs, except: module function nodes have 0-outdegree module function nodes have 0-outdegree module call nodes have 0-indegree module call nodes have 0-indegree

Wiring Bug Examples BlinkM’s provided Init interface not wired BlinkM’s provided Init interface not wired  BlinkM never gets initialised BlinkM’s provided Init interface wired twice BlinkM’s provided Init interface wired twice possible incorrect behaviour possible incorrect behaviour provided Timer interface non-shareable, wired twice provided Timer interface non-shareable, wired twice  incorrect behaviour (wrong rate in one user) used split-phase interface wired twice used split-phase interface wired twice ex: interface Send { command send(); event sendDone(); } ex: interface Send { command send(); event sendDone(); }  two responses on every request, will misbehave

Component Graph Example (1)

Component Graph Example (2)

Wiring Bugs: The Fix BlinkM’s provided Init interface not wired BlinkM’s provided Init interface not wired  BlinkM never gets initialised BlinkM’s provided Init interface wired twice BlinkM’s provided Init interface wired twice possible incorrect behaviour possible incorrect behaviour provided Timer interface non-shareable, wired twice provided Timer interface non-shareable, wired twice  incorrect behaviour (wrong rate in one user) used split-phase interface wired twice used split-phase interface wired twice ex: interface Send { command send(); event sendDone(); } ex: interface Send { command send(); event sendDone(); }  two responses on every request, will misbehave Fixes: restrict wiring cardinality Fixes: restrict wiring cardinality ≥ 1 = 1 ≤ 1 = 1

Wiring Bugs: The Fix module BlinkM { provides interface provides interface uses interface uses interface implementation { command Init.init() { command Init.init() { call Timer.setRate(); call Timer.setRate(); } event Timer.fired() { } event Timer.fired() { : new syntax for annotations (see Java : new syntax for annotations (see Java 1.5) atmostonce, atleastonce, exactlyonce : atmostonce, atleastonce, exactlyonce : wiring annotations on provided, used interfaces wiring annotations on provided, used interfaces apply to each function in an interface apply to each function in an interface imply a global check on program’s wiring graph imply a global check on program’s wiring graph

Bugs in Language Design What do the annotations mean? What do the annotations mean? Obvious proposal: node in/out degree Obvious proposal: node in/out degree ≤1

Bugs in Language Design What do the annotations mean? What do the annotations mean? Obvious proposal: node in/out degree Obvious proposal: node in/out degree “Correct” answer appears to be: “Correct” answer appears to be: provided functions: number of paths to this function provided functions: number of paths to this function used functions: number of paths from this function call used functions: number of paths from this function call ≤1

Another Problem What does this mean in a configuration? What does this mean in a configuration? Is this program right? wrong? Is this program right? wrong? provides interface

Another Problem What does this mean in a configuration? What does this mean in a configuration? Is this program right? wrong? Is this program right? wrong? Proposal: correct rule is: Proposal: correct rule is: provided function: check number of paths to this node provided function: check number of paths to this node used function: check number of paths from this node used function: check number of paths from this node note: for bi-directional interfaces, this means that you check both the paths to and from the node note: for bi-directional interfaces, this means that you check both the paths to and from the node provides interface

Does this do all we want? Matched request/reply makes split-phase programs simpler Matched request/reply makes split-phase programs simpler  Let’s use exactlyonce ! module Simple { uses interface Send; uses interface Send;} implementation { int state; int state; void somefn() { void somefn() { state = SENDING; state = SENDING; call Send.send(); call Send.send(); } event Send.sendDone() { event Send.sendDone() { if (state == SENDING) … if (state == SENDING) … }} interface Send { command send(); command send(); event sendDone(); event sendDone();}

Does this do all we want? Matched request/reply makes split-phase programs simpler Matched request/reply makes split-phase programs simpler  Let’s use exactlyonce ! Code is simpler Code is simpler module Simple { uses interface Send uses implementation { void somefn() { void somefn() { call Send.send(); call Send.send(); } event Send.sendDone() { event Send.sendDone() { … }} interface Send { command send(); command send(); event sendDone(); event sendDone();}

Does this do all we want? Matched request/reply makes split-phase programs simpler Matched request/reply makes split-phase programs simpler  Let’s use exactlyonce ! Code is simpler Code is simpler Check is insufficient  Check is insufficient  module Simple { uses interface Send uses implementation { void somefn() { void somefn() { call Send.send(); call Send.send(); } event Send.sendDone() { event Send.sendDone() { … }} Simple =1 send sendDone interface Send { command send(); command send(); event sendDone(); event sendDone();}

Conclusion Wiring bugs are hard to find Wiring bugs are hard to find Some of these bugs can be caught with annotations that restrict paths in the wiring graph: Some of these bugs can be caught with annotations that restrict paths in the wiring graph: atleastonce : at least one path to/from here atleastonce : at least one path to/from here atmostonce : at most one path to/from here atmostonce : at most one path to/from here exactlyonce : exactly one path to/from here exactlyonce : exactly one path to/from here Does not cover all needs Does not cover all needs could add singlepath : all nodes in path have in/out degree at most one could add singlepath : all nodes in path have in/out degree at most one The annotation syntax will be in nesC 1.2, and will be user-extensible (see Java 1.5 specification for general idea) The annotation syntax will be in nesC 1.2, and will be user-extensible (see Java 1.5 specification for general idea)