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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
152 Chapter 9. Conclusions and Future Work<br />
9.2.1 Problem Analysis: Shortcomings of Event-driven<br />
<strong>Programming</strong><br />
In Chapter 4 we have contributed a thorough analysis of the original eventdriven<br />
model in the context of sensor networks. Firstly, we have analyzed<br />
the two main problems of the existing event-driven programming paradigm.<br />
While the basic problem leading to unstructured and un-modular program code,<br />
namely manual state management, has already been identified and documented<br />
in previous work, the memory inefficiency of event-driven sensor-node programs<br />
incurred by manual state management has not been analyzed be<strong>for</strong>e.<br />
Secondly we have contributed by analyzing the anatomy of sensor node applications.<br />
We have found that, though easy and intuitive <strong>for</strong> small and simple<br />
programs, event-driven programs do not describe typical sensor-node applications<br />
very well. That is, the conceptual models that programmers create in their<br />
minds be<strong>for</strong>e implementing a particular program or algorithm does not map<br />
easily to the event-driven programming model. In particular, we have identified<br />
the lack of an abstraction that allows programmers to structure their programs<br />
along the time domain into discrete program phases. We have shown that several<br />
algorithms from the literature are indeed described as systems partitioned<br />
into discrete phases, each having distinctive data state and behavior. The findings<br />
of our problem analysis now allows to better evaluate current and future<br />
programming models <strong>for</strong> sensor networks.<br />
9.2.2 Solution Approach: <strong>State</strong>-based <strong>Programming</strong> with<br />
OSM<br />
To alleviate the problems described above, we have proposed a sensor-node programming<br />
model that is extending the event-driven model with well-known<br />
state-machine abstractions. In Chapter 5 we contribute by presenting such a<br />
model, which we call the OBJECT STATE MODEL (OSM). OSM is based on abstractions<br />
of hierarchically and concurrent state machines. Though they have<br />
been used successfully in embedded-systems programming <strong>for</strong> several years,<br />
they have not yet been applied to the field of sensor networks.<br />
Besides relying on proven programing abstractions, our OSM model also introduces<br />
the concept of state variables. <strong>State</strong> variables supports the memoryefficient<br />
storage and use of temporary data. <strong>State</strong> variables resemble local variables<br />
of sequential programs; both are automatically memory managed and thus<br />
their memory is automatically reused when no longer needed. <strong>State</strong> variables<br />
can help overcome the inherent memory inefficiency of event-driven programming<br />
<strong>for</strong> storing temporary data. Besides that, the maximum memory requirements<br />
of all parts of even highly-concurrent programs can be calculated at compile<br />
time. This allows to check whether a particular program can run on a given<br />
sensor node and to easily identify program parts susceptible <strong>for</strong> optimizations.<br />
Finally, OSM introduces the concept of entry and exit actions (also referred to<br />
as incoming and outgoing actions) to traditional state-machine programming<br />
models. They allow to elegantly and efficiently specify the initialization and<br />
release of state-specific resources, which are common tasks in real-world sensornode<br />
programs.