21.08.2013 Views

A State-Based Programming Model for Wireless Sensor Networks

A State-Based Programming Model for Wireless Sensor Networks

A State-Based Programming Model for Wireless Sensor Networks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.5. Overview and Examples of <strong>State</strong>-of-the-Art Operating Systems 57<br />

ating systems and programming frameworks today. Since its introduction in<br />

2000, TinyOS has gained significant impact, possibly because of the success in<br />

the commercialization of its standard hardware plat<strong>for</strong>m, the Berkeley Motes.<br />

The early availability of the complementary combination of the freely available<br />

and well-supported programming framework and sensor-node hardware<br />

has made experimentation accessible to researchers without embedded systems<br />

background and without capabilities to develop and manufacture their own<br />

hardware.<br />

TinyOS targets resource-constrained sensor nodes and has been implemented<br />

on the Berkeley Mote family as well as other sensor nodes, such as the<br />

BTnode [78]. Its goal is to provide standard sensor-node services in a modular<br />

and reusable fashion. TinyOS has a component-oriented architecture based<br />

on an event-driven kernel. System services (such as multi-hop routing, sensor<br />

access, and sensor aggregation) are implemented as a set of components with<br />

well-defined interfaces. Application programs are also implemented as a set<br />

of components. TinyOS components are programmed in a custom C dialect<br />

(called nesC), requiring a special compiler <strong>for</strong> development. A simple declarative<br />

language is used to connect these components in order to construct more<br />

complex components or entire applications. The designers of TinyOS consider it<br />

a static language, as it supports neither dynamic-memory allocation, nor process<br />

concurrency or dynamic loading. (It does, however, provide static over-the-air<br />

reprogramming).<br />

TinyOS has an event-driven programming model. However, it has two levels<br />

of scheduling, rather than just one, as all other event-driven programming<br />

frameworks <strong>for</strong> sensor nodes. The scheduled entities are called tasks and events.<br />

This terminology is highly confusing: TinyOS tasks have no similarities to tasks<br />

in multi-tasking systems. Rather, a TinyOS task is what in event-driven systems<br />

is commonly known as an action or event handler. TinyOS tasks are scheduled<br />

sequentially by the scheduler and run to completion only with respect to other<br />

TinyOS tasks. They may be interrupted, however, by TinyOS events.<br />

A TinyOS event is not what is commonly considered an event in the eventdriven<br />

systems (i.e., a condition triggering an action). Rather, it is a timecritical<br />

computational function that may interrupt the regular control flow<br />

within TinyOS tasks as well as other TinyOS events. TinyOS events have been<br />

introduced so that a small amount of processing associated with hardware interrupts<br />

can be per<strong>for</strong>med as fast as possible, without scheduling overhead but<br />

instead interrupting long-running tasks. TinyOS events are required to complete<br />

as fast as possible, in order not to delay any other time-critical TinyOS events.<br />

As such, TinyOS events are programming abstractions <strong>for</strong> interrupt service routines.<br />

Apart from being triggered by hardware interrupts, TinyOS events can<br />

also be invoked by regular code. Then they behave like regular functions.<br />

Besides, TinyOS tasks and TinyOS events, TinyOS has a third programmatic<br />

entity, called commands. TinyOS commands resemble functions of sequential<br />

programming languages but have certain restrictions (e.g., they may not invoke<br />

TinyOS events).<br />

TinyOS applications can have a graph-like structure of components but are<br />

often hierarchical. Each component has a well-defined interface that can be used<br />

to interconnect multiple components to construct more complex components

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!