Nano-RK
Nano-RK is a wireless sensor networking real-time operating system from Carnegie Mellon University, designed to run on microcontrollers for use in sensor networks. Nano-RK supports a fixed-priority fully preemptive scheduler with fine-grained timing primitives to support real-time task sets. "Nano" implies that the RTOS is small, using 2 KB of random-access memory and using 18 KB of flash memory, while RK is short for resource kernel. A resource kernel provides reservations on how often system resources can be used. For example, a task might only be allowed to execute 10 ms every 150 ms, or a node might only be allowed to transmit 10 network packets per minute. These reservations form a virtual energy budget to ensure a node meets its designed battery lifetime and to prevent a failed node from generating excessive network traffic. Nano-RK is open-source software, is written in C and runs on the Atmel-based FireFly sensor networking platform, the MicaZ motes, and the MSP430 processor.
Tradeoffs occur when using an RTOS in sensor networks.
Advantages
NanoRK takes advantage of priority-based preemptive scheduling to help honor the real-time factor of being deterministic, thus ensuring task timeliness and synchronization. Due to the characteristic of limited battery power on the wireless node, Nano-RK provides central processing unit, network, and sensor efficiency through the use of virtual energy reservations, labeling this system as a resource kernel. These energy reservations can enforce energy and communication budgets to minimize the negative impact on the node's operational lifetime from unintentional errors or malicious behavior by other nodes within the network. It supports packet forwarding, routing and other network scheduling protocols with the help of a light-weight wireless networking stack. Compared with other current sensor operating systems, Nano-RK provides rich functionality and timeliness scheduling with a small size for its embedded resource kernel.Features
Static Configuration – Nano-RK uses a static design-time approach for energy use control, and disallows dynamic task creation, requiring application developers to set both task and reservation quotas/priorities in a static testbed design. This design allows creating an energy budget for each task to maintain application requirements and energy efficiency throughout the system's lifetime. Using a static configuration approach, all of the runtime configurations, and the power requirements, are predefined and verified by the designer before the system is deployed and executed in the real world. This approach also helps to guarantee the stability and small-size characteristics relative to traditional RTOSs.Watchdog Timer support – Watchdog is a software timer that triggers a system reset action if the system hangs on crucial faults for an extended period of time. The watchdog mechanism can bring the system back from the nonresponsive state into normal operation by waiting until the timer goes off and subsequently rebooting the device. In Nano-RK, the watchdog timer is tied directly to the processor's reset signal REBOOT ON ERROR. By default, it is enabled when the system boots and reset each time the scheduler executes. If the system fails to respond within the predefined time period, the system will reboot and run the initialization instruction sequence to hopefully regain control.
Deep Sleep Mode – For energy efficiency reasons, if there are no eligible tasks to run, the system can be powered down and given the option to enter deep sleep mode. When the system is in this mode, only the deep sleep timer can wake the system with a predefined latency period. After waking from sleep mode, the next context swap time is set to guarantee the CPU wakes in time. If a sensor node does not wish to perform deep sleep, it also is presented with the choice to go into a low energy use state while still managing its peripherals.