Run-Time Dynamic Linking for Reprogramming Wireless Sensor Networks

Slides:



Advertisements
Similar presentations
UEE072HM Linking HLL and ALP An example on ARM. Embedded and Real-Time Systems We will mainly look at embedded systems –Systems which have the computer.
Advertisements

Program Development Tools The GNU (GNU’s Not Unix) Toolchain The GNU toolchain has played a vital role in the development of the Linux kernel, BSD, and.
Assembler/Linker/Loader Mooly Sagiv html:// Chapter 4.3 J. Levine: Linkers & Loaders
Chapter 3 Loaders and Linkers
Mr. D. J. Patel, AITS, Rajkot 1 Operating Systems, by Dhananjay Dhamdhere1 Static and Dynamic Memory Allocation Memory allocation is an aspect of a more.
Linkers and Loaders 1 Linkers & Loaders – A Programmers Perspective.
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
Compilation Technology Oct. 16, 2006 © 2006 IBM Corporation Software Group Reducing Startup Costs of Java Applications with Shared Relocatable Code Derek.
ASU Real-Time Operating System. Supervised by: Dr. Mohammed Sobh.
Linking and Loading Fred Prussack CS 518. L&L: Overview Wake-up Questions Terms and Definitions / General Information LoadingLinking –Static vs. Dynamic.
Impala: A Middleware System for Managing Autonomic, Parallel Sensor Systems Ting Liu and Margaret Martonosi Princeton University.
A Dynamic Operating System for Sensor Nodes (SOS) Source:The 3 rd International Conference on Mobile Systems, Applications, and Service (MobiSys 2005)
Leveraging IP for Sensor Network Deployment Simon Duquennoy, Niklas Wirstrom, Nicolas Tsiftes, Adam Dunkels Swedish Institute of Computer Science Presenter.
Characteristics of Realtime and Embedded Systems Chapter 1 6/10/20151.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Node-level Representation and System Support for Network Programming Jaein Jeong.
Memory Management 2010.
Software Development and Software Loading in Embedded Systems.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Computer Organization
Programming Memory-Constrained Networked Embedded Systems
Mihai GALOS - ICECS Dynamic reconfiguration in Wireless Sensor Networks Mihai GALOS, Fabien Mieyeville, David Navarro Lyon Institute of Nanotechnology.
WISEBED - Wireless Sensor Network Testbeds Wiselib: A Generic Algorithm Library for Heterogeneous Sensor Networks* Tobias Baumgartner 1, Ioannis Chatzigiannakis.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
A genda for Today What is memory management Source code to execution Address binding Logical and physical address spaces Dynamic loading, dynamic linking,
MIPS coding. SPIM Some links can be found such as:
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
Linking and Loading Linker collects procedures and links them together object modules into one executable program. Why isn't everything written as just.
TRICKLE: A Self-Regulating Algorithm for Code Propagation and Maintenance in Wireless Sensor Networks Philip Levis, Neil Patel, Scott Shenker and David.
Embedded Runtime Reconfigurable Nodes for wireless sensor networks applications Chris Morales Kaz Onishi 1.
Simon Han – Ram Kumar Rengaswamy – Roy Shea – Mani Srivastava – Eddie Kohler –
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
RNJ 05/05/091 6 Further System Fundamentals (HL) ‏ 6.3 Operating Systems and Utility Software Linkers, Loaders and Library Managers.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Memory Management Operating Systems CS550. Memory Manager Memory manager - manages allocation and de-allocation of main memory Plays significant impact.
1 CS503: Operating Systems Spring 2014 Part 0: Program Structure Dongyan Xu Department of Computer Science Purdue University.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
A Dynamic Operating System for Sensor Nodes Chih-Chieh Han, Ram Kumar, Roy Shea, Eddie Kohler, Mani, Srivastava, MobiSys ‘05 Oct., 2009 발표자 : 김영선, 윤상열.
Full and Para Virtualization
Introduction to Assembly Programming Computer Architecture.
Software Development Introduction
NETW3005 Memory Management. Reading For this lecture, you should have read Chapter 8 (Sections 1-6). NETW3005 (Operating Systems) Lecture 07 – Memory.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
CSc 453 Linking and Loading
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Object Files & Linking. Object Sections Compiled code store as object files – Linux : ELF : Extensible Linking Format – Windows : PE : Portable Execution.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
Binding & Dynamic Linking Presented by: Raunak Sulekh(1013) Pooja Kapoor(1008)
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Computer System Structures
Lecture 3 Translation.
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
Linking & Loading.
Program Execution in Linux
CS-3013 Operating Systems C-term 2008
An Embedded Software Primer
2.1. Compilers and Interpreters
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Linking & Loading CS-502 Operating Systems
Computer Architecture
Program Execution in Linux
Linking & Loading CS-502 Operating Systems
Overview: Active Sensor networks
Presentation transcript:

Run-Time Dynamic Linking for Reprogramming Wireless Sensor Networks Adam Dunkels, Niclas Finne, Joakim Eriksson, Thiemo Voigt Swedish Institute of Computer Science ACM SenSys 2006

The setting: software updates in sensor networks We are here Operating system with loadable native code modules

We all have our own way of doing loadable modules Contiki [EmNetS 2004] Statically linked modules, relocation at run-time SOS [MobiSys 2005] Modules with position independent code Why not just do it the standard “Linux” way? Run-time linking of ELF files Availability of tools, knowledge Are we compelled to do it our own way? Or do we choose to do it our own way? Can we even do it the “Linux” way in microsensor networks? Given the severe resource constraints: 2k RAM, 60k ROM If we could, what would the overhead be?

What we’ve done Developed a dynamic linker for Contiki Link, relocate, load standard ELF files CVM (Contiki VM) – a virtual machine Typical, stack-based virtual machine Compiler for a subset of Java Java virtual machine Ported the leJOS Java VM to Contiki

Conclusions Proof of concept: dynamic linking of ELF files is possible and feasible for sensor networks Code size < 2k, memory size < 100 bytes Acceptable transmission overhead (ELF size factor 3) Communication is by far the dominating factor Energy consumption for the dynamic linking is low Depending on the scenario, combinations may be the most efficient Virtual machine code with dynamically loaded native libraries

The details…

Reprogramming methods Virtual machines, script languages Native code Full image replacement The default method for many embedded systems, TinyOS Delta/diff-based approaches Compare two versions of the compiled code, transmit only the changes Need to know both versions Loadable modules Requires support from operating system

Loadable modules ROM RAM Loadable module RAM Loadable module System core System core

Linking, relocation, loading ROM Loading Relocation Linking RAM 0x2300 jmp 0x2300 while(1) { send(); } void send() { /* … */ } 0x164b 0x0000 call 0x0000 call 0x164b Loadable module jmp 0x0000 System core

Linking, relocation, loading ROM Loading 0x2300 call 0x164b Loadable module jmp 0x2300 void send() { /* … */ } 0x164b System core

Static pre-linking, position independent code ROM Static pre-linking Do all linking at compile time Must know all core addresses at compile time All nodes must be exactly the same Configuration management nightmare Contiki [EmNetS 2004] Position-independent code No need for relocation Only works on certain CPU architectures Limitations on module size SOS [Mobisys 2005] 0x2300 call 0x164b Loadable module jmp 0x2300 void send() { /* … */ } 0x164b System core

Dynamic linking needs meta-data ROM Addresses of all locations that needs to be patched The names of called functions and accessed variables Symbol table in core ELF – Executable Linkable Format Contains code, data, relocation/linking information, referenced symbols Standard format for Linux, Solaris, FreeBSD, … The output format from gcc (.o files) Many tools available 0x2300 call 0x164b Loadable module jmp 0x2300 void send() { /* … */ } 0x164b System core

“ELF16” The obvious problem with ELF files: The obvious optimization: ELF (ELF32) uses 32-bit structures Lots of “air” in an ELF file for a 16-bit CPU The obvious optimization: “ELF16” – (Compact ELF) like ELF but with 16- bit structures The dynamic loader works with both ELF32 and “ELF16” file – only the structure definitions are different

The virtual machines CVM – Contiki VM The leJOS Java VM A stack-based, typical virtual machine A compiler for a subset of Java The leJOS Java VM Adapted to run in ROM Executes Java byte code Bundled .class files

So how well does it work?

Memory footprint ROM size of dynamic linker ~ 2k code ~ 4k symbol table Full Contiki system, automatically generated Dynamic linking feasible for memory-constrained systems But CVM is better Module ROM RAM Static loader 670 Dynamic linker 5694 78 CVM 1344 8 Java VM 13284 59

Quantifying the energy consumption Measure the energy consumption: Radio reception, measured on CC2420, TR1001 A lower bound, based on average Deluge overhead Storing data to EEPROM Linking, relocating object code Loading code into flash ROM Executing the code Two boards: ESB, Telos Sky (both MSP430)

Receiving 1000 bytes with the CC2420

Receiving 1000 bytes with the TR1001

Energy consumption of the dynamic linker

Loading, linking native code vs virtual machine code ELF “ELF16” CVM Java Size 1824 968 123 1356 Reception 29 12 2 22 Storing 1 Linking 3 Loading 5 Total 35 17 27 Object tracking application

ELF file size Average ELF overhead 3, average “ELF16” overhead 1 Code Data ELF ELF size factor “ELF16” “ELF16” size factor Blinker 130 14 1056 7.3 361 2.5 Object tracker 344 22 1824 5.1 968 2.7 Code propagator 2184 10 5696 2.6 3686 1.7 Flood/converge 4298 42 8456 1.9 5399 1.2 Average ELF overhead 3, average “ELF16” overhead 1

Running native code vs virtual machine code Time (ms) Energy (mJ) Native 0.67 0.00075 CVM 58.52 0.065 Java 65.6 0.073 8x8 vector convolution Computationally “heavy” Object tracking application Uses native code library Most of the code is spent running native code Time (ms) Energy (mJ) Native 0.479 0.00054 CVM 0.845 0.00095 Java 1.79 0.0020

Break even points, vector convolution “ELF16”

Break-even points, object tracking “ELF16”

Conclusions Dynamic loading of native code in standard ELF files is feasible in sensor networks The overhead lies in the transmission, not the linking Code size ~2k, memory size < 100 bytes ELF format has ~ 300% overhead (“ELF16” has ~ 100% overhead) Sometimes other factors outweigh the energy overhead Availability of tools Dynamically linked native code vs virtual machines Combinations: virtual machine code with dynamically linked native code

Questions?

Full image replacement Blinker application Module 150 bytes ELF file 1k Full system 20k 2000% energy overhead Dynamic linking (mJ) Full image (mJ) Receive 17 330 Store 1.1 22 Link 1.4 Load 0.45 72 Total 20 424

Portability of the dynamic linker Dynamic linker consists of two parts Generic ELF code Architecture specific relocation and loading code Lines of code, total Lines of code, relocation function Generic 292 - MSP430 45 8 AVR 143 104

Scenarios for software updates Software development for sensor networks Small updates, often, at any level, programs short-lived Sensor network test-beds Large updates, seldom, at the application level, programs long-lived Fixing bugs Small updates, seldom, at any level, programs long-lived Application reconfiguration Very small updates, seldom, at the application level, programs long- lived Dynamic applications Small updates, often, at the application level, programs long-lived