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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1 Introduction<br />

1.1 Background<br />

Over the past decades, advances in sensor technology, miniaturization and lowcost,<br />

low-power chip design have led to the development of wireless sensor<br />

nodes: small, inexpensive, and programmable devices that combine computing,<br />

sensing, short-range wireless communication, and an autonomous power<br />

supply. This development has inspired the vision of wireless sensor networks—<br />

wireless networks of sensor nodes that can be deployed in the environment at<br />

the large scale to unobtrusively monitor phenomena of the real world. There<br />

is a wide range of applications envisioned <strong>for</strong> such wireless sensor networks,<br />

including precision agriculture, monitoring of fragile goods and building structures,<br />

monitoring the habitat of endangered species and the animals themselves,<br />

emergency response, environmental and micro-climate monitoring, logistics,<br />

and military surveillance.<br />

The most popular programming model <strong>for</strong> developing sensor-network applications<br />

today is the event-driven model. Several programming frameworks<br />

based on that model exist, <strong>for</strong> example, the BTnode system software [21], Contiki<br />

[37], the TinyOS system software [59] and nesC programming language [45],<br />

SOS [52] and Maté [79]. The event-driven model is based on two main abstractions:<br />

events and actions. Events in the context of event-driven programming<br />

can be considered abstractions of real-world events. Events are typically typed<br />

to distinguish different event classes and may contain parameters, <strong>for</strong> example,<br />

to carry associated event data. At runtime, the occurrence of an event can trigger<br />

the execution of a computational action. Typically, there is a one-to-one association<br />

between event types and actions. Then, an event-driven program consists<br />

of as many actions as there are event types. Actions are typically implemented<br />

as functions of a sequential programming language. They always run to completion<br />

without being interrupted by other actions. In order not to monopolize<br />

the CPU <strong>for</strong> any significant time, actions need to be non-blocking. There<strong>for</strong>e, at<br />

any point in the control flow where an operation needs to wait <strong>for</strong> some event<br />

to occur (e.g., a reply message or acknowledgment), the operation must be split<br />

into two parts: a non-blocking operation request and an asynchronous completion<br />

event. The completion event then triggers another action, which continues<br />

the operation.<br />

One of the main strengths of the event-driven model is that its support in the<br />

underlying system software incurs very little memory and runtime overhead.<br />

Also, the event-driven model is simple, yet intuitively captures the reactive nature<br />

of sensor-network applications. In contrast, the multi-threaded programming<br />

model, another programming approach that has been applied to wireless<br />

sensor networks, is typically considered to incur too much memory and computational<br />

overhead (mainly because of per-thread stacks and context switches).

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

Saved successfully!

Ooh no, something went wrong!