Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh CS252, CS262A, Fall The.

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

Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Chapter 6 Limited Direct Execution
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Towards System Architecture for Tiny Networked Devices David Culler U.C. Berkeley Wireless hoo-hah 5/30/2000.
PEDS September 18, 2006 Power Efficient System for Sensor Networks1 S. Coleri, A. Puri and P. Varaiya UC Berkeley Eighth IEEE International Symposium on.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Jonathan.
CS 104 Introduction to Computer Science and Graphics Problems
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
A System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley 9/22/2000.
TinyOS Software Engineering Sensor Networks for the Masses.
1 Ultra-Low Duty Cycle MAC with Scheduled Channel Polling Wei Ye Fabio Silva John Heidemann Presented by: Ronak Bhuta Date: 4 th December 2007.
1 EE249 Discussion System Architecture Directions for Networked Sensors (J. Hill, et al) Presented By: Sarah Bergbreiter EE249 Discussion Section October.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Intro to OS CUCS Mossé Processes and Threads What is a process? What is a thread? What types? A program has one or more locus of execution. Each execution.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Spring 2000, 4/27/00 Power evaluation of SmartDust remote sensors CS 252 Project Presentation Robert Szewczyk Andras Ferencz.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
Protection and the Kernel: Mode, Space, and Context.
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
CS533 Concepts of Operating Systems Jonathan Walpole.
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.
Multiple Access.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Oindrila.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Processes and Virtual Memory
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Lecture on Central Process Unit (CPU)
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
System Architecture Directions for Networked Sensors.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Interrupt Handler Migration and Direct Interrupt Scheduling for Rapid Scheduling of Interrupt-driven Tasks Reviewer: Kim, Hyukjoong ESLab.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Soft Timers : Efficient Microsecond Software Timer Support for Network Processing - Mohit Aron & Peter Druschel CS533 Winter 2007.
Memory Protection: Kernel and User Address Spaces Andy Wang Operating Systems COP 4610 / CGS 5765.
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
INTRODUCTION TO WIRELESS SENSOR NETWORKS
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Simulation of Distributed Application and Protocols using TOSSIM
Memory Protection: Kernel and User Address Spaces
CS 3305 System Calls Lecture 7.
CS 286 Computer Organization and Architecture
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Synchronization Issues
Direct Memory Access Disk and Network transfers: awkward timing:
Lecture Topics: 11/1 General Operating System Concepts Processes
Computer Organization
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Jacob R. Lorch and Alan Jay Smith University of California, Berkeley
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Co-designed Virtual Machines for Reliable Computer Systems
Memory Protection: Kernel and User Address Spaces
Presentation transcript:

Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh CS252, CS262A, Fall The Problem 1.Tiny OS is an event-based Operating System environment for wireless network of deeply embedded systems. 2.Runs on low-power autonomous sensor nodes. -> Real need to cut power consumption. 3.Context switch is the most expensive software primitive in Tiny OS ->Reflected in the fact that most of the active execution cycles (>66%) are spent in RFM (lowest level component) during the reception of a packet. 4.Want to reduce the number of active cycles: reduce the RFM component’s work – make interrupts more effective. Components Packet reception work breakdown Percent CPU UtilizationEnergy (nj/Bit) AM 0.05%0.20%0.33 Packet 1.12%0.51%7.58 Ratio handler 26.87%12.16% Radio decode thread 5.48%2.48%37.2 RFM 66.48%30.08% Radio Reception Idle-54.75%- Total % Primitives Average Cost (cycles) Time (us) Normalized to byte copy Byte copy 821 Post an Event Call a Command Post a Thread Context Switch Interrupt (HW cost) Interrupt (SW cost) Lightweight Interrupt Handler: 1.With register window, the number of register available decreases -> increased pressure on register spills. 2.Need interrupt handlers that uses less register. 3.Can achieve this by delaying the handling of interrupts by posting a thread that fires off the event instead of firing it. 4.However, there is a catch: 1.Thread scheduler turned out to be the most register-intensive operation, therefore it must be re-written in assembly code before the lightweight interrupt handler is feasible. 2.It actually increases the handling time of events by adding thread posting/scheduling overhead and waste energy. 5.It would also help in cases where the interrupt handler wants to use some restricted registers which are not accessible to interrupt code. (e.g., reserved registers used for multiplications) Optimistic (Lazy) Interrupt Handler: 1.Most of the time when an interrupt happens, the processor is in sleep mode (I.e., no thread is running at that time.) 2.If no thread is running when an interrupt happens, there is no need to save registers. 3.Solution: set aside a register, set it when the processor enters sleep mode. In the beginning of interrupts, check the flag and skip the saving and restoring of registers if the flag is set. The Evaluation 1.Used an existing AVR 8535 simulator. 2.Added simulated radio transceiver, LED, photo sensors to the simulator to make a simulated mote. 3.Take the following parameters during the reception of one packet (97 bits at 6Kbps, about 12.5us): 1.Number of cycles in sleep mode 2.Energy consumed. 3.Number of cycles in which interrupts are disabled. 4.Number of interrupts lost 1.Network simulation model 1.All motes simulated in lock-step 2.At each mote, the radio states of each in-range mote is compared to detect reception and collisions 3.Network state is propagated back into the mote simulators 2.Measure the number of interrupts that are lost. 3.Still work in progress. Network simulator: 1.TinyOS and application software typically uses about half of the available registers 1.Some registers can be reserved for interrupt handling 2.AVR has an asymmetric register set with some registers that are more general than others. Each resource pool must be partitioned separately to generate good code 2.Two variants of AVR compiler, each with own modified gcc backend to disallow use of certain registers 1.Registers used by other mode are marked as unspillable, fixed-use registers 2.Each mode has separate calling convention and low-level libraries 3.Post-compilation filter on interrupt-mode compiler 1.Interrupt handlers and their callee functions are extracted and renamed, then combined with output of user-mode compiler 4.Still a work in progress (compiled with user version gcc and interrupt version gcc, but linking is too slow). Software simulated register window: R31 R30 R29 R28 R27 R26 R25 R24 R20-R23 R16-R19 R8-R15 R2-R7 R1 R0 Shared registers 1.Stack, Frame, indirect-PC address registers User registers 1.R8-R15 cannot be used with immediate operands Interrupt registers 1.R2-R7 cannot be used for immediate operands CPU simulator: The Proposals Timing Diagram of Lightweight Event Propagation Timing Diagram of Event Propagation Interrupt handler Timer_interrupt_thread //pseudo code: Void __interrupt__ ()(naked) { if (wasSleeping) { wasSleeping = FALSE; naked_interrupt(); } else { clothed_interrupt(); } Void naked_interrupt()(naked){ // does work... asm (“reti”); } Void clothed_interrupt()(signal) { naked_interrupt(); } ConfigurationSleep Cycles (%)Energy (uJ)Interrupt-disabled Cycles(%) Lost Interrupt Original Interrupt Handler15.33% %0 Lightweight Interrupt Handler5.45% %100 Lazy Interrupt Handler28.95% %0 Conclusions & Future work: 1.We must be very careful when designing the interrupt handler. For example, making the interrupt handler “lightweight” actually increases the workload of the CPU to a point where it will be too busy to take interrupts. 2.Investigate the impact of other fast context-switch mechanisms (e.g., shadow registers) using the simulation environment 3.Fully explore the design space of interrupt handlers.