Chinaunix首页 | 论坛 | 博客
  • 博客访问: 493523
  • 博文数量: 102
  • 博客积分: 4001
  • 博客等级: 上校
  • 技术积分: 756
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-21 16:01
文章分类

全部博文(102)

文章存档

2011年(1)

2010年(1)

2009年(56)

2008年(44)

我的朋友

分类:

2009-08-19 11:38:44

最近看了篇关于TinyOS简介的文章,摘录出来保存下,介绍tinyos编程入门的资料不少,但从操作系统的角度分析tinyos是有必要的,毕竟TinyOS做为无线传感网络操作系统中最重要的一种,也是最常用的一种,分析它的实现机制有助于以后改进针对无线传感网络的操作系统,也是嵌入式操作系统的一类。

An open-source operating system designed for wireless embedded sensor network. More specifically, it is designed to support the concurrency intensive operations required by networked sensors with minimal hardware requirements.
TinyOS Features
• No Kernel: Direct hardware manipulation.
• No Process Management: Only one process on the fly.
• No Virtual Memory: Single linear physical address space.
• No S/w Signal or Exception: Function call instead.
• No User Interface, power constrained.
• Unusually application specific H/w and S/w.
• Multiple flows, concurrency intensive bursts.
• Extremely passive vigilance (power saving).
• Tightly coupled with the application.
• Simulator: TOSSIM, PowerTOSSIM
• Written in “nesC” Language, a dialect of the ‘C’ language.

TinyOS uses multi-hop routing instead of point-to-point connections to save transmission power. Route discovery is done by 2-hop broadcast and topology discovery is based on shortest path from each node to the base station.

The paradigm for network transmissions in TinyOS is active messaging. Messages contain a handler address and on arrival this handler is called.

TinyOS Architecture

Component Based Architecture: enables rapid innovation and implementation while minimizing code size as required by the severe memory constraints inherent in sensor networks.

Small footprint: fits in 178 Bytes of memory.

Event based instead of threaded architecture.

     start and stop are commands.

    fired is a event invoked by Timer.

    The interface specifies: Timer must implement startand stop, Application must implement fired.

o Propagates events in time it takes to copy 1.25 Bytes.

o Switches context in the time to copy 6 Bytes ofMemory.

Radio and Clock have interrupts.

Non-blocking/Non-preemptive Scheduling: Tasks will not preempts other tasks and run in FIFO order but only interrupts and associated events can preempt tasks. Toavoid blocking scenarios, events and commands are expected to do only state transmissions and leave complex computations to tasks that can be preempted if necessary. This simple concurrency model is typically sufficient for I/O centric applications, but its difficulty with CPU-heavy applications has led to several

proposals for incorporating threads into the OS.

TinyOS has a Single Stack: TinyOS uses a simple queue with length 7 and a two level scheduling. Therefore, all I/O operations that last longer than a few hundred microseconds are asynchronous and have a callback. A TinyOS component can post a task, which the OS will schedule to run later.

To support larger computations, TinyOS provides tasks, which are similar to a Deferred Procedure Call and interrupt handler bottom halves. Latest version of TinyOS has numerous improvements such as: Safe TinyOS , a compile-time option that lets us incorporate run-time memory safety checks into oour application, TOSThreads , a threading library that runs on top of a standard TinyOS core etc.

阅读(2353) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~