Design and Impletentation of Flexible and Memory Efficient
Operating System for Sensor Nodes

R.C.Hansdah, Deepak Ravi, Sahebrao Sidram Baiger, Amulya Ratna

Sensor network nodes exhibit characteristics of both embedded systems and general-purpose systems. A sensor network operating system is a kind of embedded operating system, but unlike a typical embedded operating system, sensor network operating system may not be real time, and is constrained by memory and energy constraints. Most sensor network operating systems are based on event-driven approach. Event-driven approach is efficient in terms of time and space. Also this approach does not require a separate stack for each execution context. But using this model, it is difficult to implement long running tasks, like cryptographic operations. A thread based computation requires a separate stack for each execution context, and is less efficient in terms of time and space. In this paper, we propose a thread based execution model that uses only a fixed number of stacks. In this execution model, the number of stacks at each priority level are fixed. It minimizes the stack requirement for multi-threading environment and at the same time provides ease of programming. We give an implementation of this model in Contiki OS by separating thread implementation from protothread implementation completely. We have tested our OS by implementing a clock synchronization protocol using it.