13 October 2016

What is Contiki?

Contiki is an operating system (OS) that was designed specifically for resource-constrained sensor nodes. An OS for sensor nodes must support lightweight mechanisms and abstractions that caters to the needs of applications while taking into consideration the limitations of the constrained devices. Contiki was developed with these constrains in mind.

Contiki is implemented in the C language. The kernel is event-driven, which allows it to support concurrency without the need for per-thread stacks or locking mechanism. Contiki uses a hybrid of event-driven systems and preemptive threads — it implements preemptive multi-threading as an application library that is optionally linked with programs that explicitly require it.

Unlike most OS for embedded systems which require a complete binary image of the entire system to be built and downloaded into each device, Contiki allows dynamic loading and unloading of programs and services at runtime.

The Contiki system consists of a kernel, libraries, a program loader and a set of processes. A process is either an application program or a service. It is defined by an event handler function and an optional poll handler function. A process state is held in the process's private memory and the kernel keeps a pointer to the process state. A service implements functionality used by more than one application processes. All processes can be dynamically replaced at runtime.

A Contiki system is partitioned into two parts:

  1. Core - consisting of the kernel, program loader and the most commonly used parts of the language runtime and support libraries, and a communication stack with device drivers for the communication devices. The core is compiled into one binary image that is stored in the devices before they are deployed. It is rarely modified, but a special boot loader can be used to overwrite or patch the core.
  2. Loaded programs - this is how programs are loaded into the system. A loaded program obtains the binaries either using the communication stack or by using directly attached storage, such as EEPROM.

The kernel supports two types of event:

  1. Asynchronous events are a form of defrerred procedure call - they are queued by the kernel and dispatched to the target process some time later.
  2. Synchronous events are similar to asynchronous events but immediately causes the target process to be scheduled. Control returns to the posting process after the target has finished processing the event.

Power conservation is a critical feature when dealing with wireless devices. The Contiki kernel does not provide an explicit power save abstraction, but allows applications to implement the mechanism. The event scheduler exposes the event queue size and applications use this information to power down the processor when no events are scheduled.

Source:

  1. A. Dunkels, B. Gronvall, T. Voigt, "Contiki - A Lightweight and Flexible Operating System for Tiny Networked Sensors", Proc. of 29th Annual IEEE International Conference on Local Computer Networks, 2004

No comments:

Post a Comment

IEEE 802.15.4e Standard

Low reliability, unbounded packet delays and no protection against interference and fading are among the limitations of the IEEE 802.15.4 ...