A Quick Overview of TinyOS and Its Simulator, TOSSIM: Insights from the 2009 Meeting
This document provides an overview of TinyOS, a simplified operating system designed for wireless sensor networks. It discusses its component-based architecture, essential interfaces, and the role of the nesC language. The presentation also highlights TOSSIM, the simulation tool for TinyOS, detailing its features and limitations. Additionally, it addresses dynamic memory allocation within TinyOS, including the challenges and capabilities of memory management for real motes versus its simulation environment. Concluding insights and future suggestions are included.
A Quick Overview of TinyOS and Its Simulator, TOSSIM: Insights from the 2009 Meeting
E N D
Presentation Transcript
A Quick Note on TinyOS Chris Merlin Group Meeting January 21st, 2009
Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
TinyOS: A Quick Reminder • A Simple and stripped down operating system for motes • nesC language • C Based • For component-based programming • Maybe a quarter million programmers in the world TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
(…2) TinyOS: A Quick Reminder • Components: black boxes whose input and output functions are known (interfaces) • Configurations: • assemble other components together • link interfaces used by components to providers • Modules: • Provide application code • Use and provide interfaces TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
(…3) TinyOS: A Quick Reminder • Consider a module called Application that needs to turn LEDs on and off • The Leds interface provides functions to turn on/off, initialize, toggle LEDs • Application would like to use that interface • LedsC is a component that provides Leds interface • Application.Leds -> LedsC.Leds; TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
TOSSIM: Generalities • Simulator: • Built with make pc • Runs with DBG=[name], build/pc/main.exe [options] • What it does: • Displays traces • Emulates mote+radio behavior • What it doesn’t do: • Model radio propagation • Model power drain / energy consumption TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Compiling and Running a Simulation • Execute: build/pc/main.exe [options] num_nodes -b=<sec>: time over which motes boot -l=<scale>: runs sim. at <scale> times real time -r=<radio>: radio model: simple, static, lossy -rf=<file>: input file for lossy model -t=<time>: runs sim. for <time> virtual seconds num_nodes: number of nodes TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
The Lossy Radio Model • Input file can specify links’ bit error rates • Lossy radio model can help create multi-hop networks of nodes • <mote ID>:<mote ID>:ber 1 1 1 0 0 1 1 TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Dynamic Memory Allocation • “TinyOS does not allow dynamic memory allocation” • True: malloc will occasionally crash, realloc not supported on real motes • False: malloc, realloc, free all work fine in TOSSIM. MemAlloc provides some DMA for real motes TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Memory Model of TinyOS • Simplicity of TinyOS allows only static mem. alloc (no management of dynamic heap) • malloc must find space of appropriate size: can be resource consuming, esp. when mem. very fragmented TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
MemAlloc • MemAlloc is provided by TinyAlloc • Some commands are: • allocate(HandlePtr hptr, int size): allocate memory region of size • reallocate(Handle h, int size) • free(Handle h) • However, MemAlloc is split-phase • Events: • allocComplete(HandlePtr hptr, result_t outcome): indicate an allocation has completed • reallocComplete(Handle h, result_t outcome) TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
MemAlloc Example • TinyAlloc implements managed heap: simple array of handles • Memory regions are referenced indirectly by another array • Double dereferencing is needed Handle array; call MemAlloc.allocate(&array, 2*sizeof(ArrayEntry)); ArrayEntry *entry = (ArrayEntry*)(*array+sizeof(ArrayEntry)) TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS
Remarks • If you have suggestions, pieces of code to add, let me know • Compiled in Tutorial on WCNG website / my Academic page