Anatomy of RTOS and Analyze The Best Fitted For Small Medium and Large Footprint Embedded Devices in Wireless Sensor Network
Anatomy of RTOS and Analyze The Best Fitted For Small Medium and Large Footprint Embedded Devices in Wireless Sensor Network
Embedded Device
changing configuration parameters to replacing
application code.
Figure 4 Timber run-time system overview 5. RTOS In Large Footprint Wireless
Embedded Device
4.3. Virtual Machine Architecture 5.1. Preemptive Scheduler
The virtual machine (VM) concept is very different Preemptive scheduling means dynamic task priority
from the alternatives so far discussed. In many management. The running tasks may be rescheduled at
constrained node application, a RTOS, particularly the any instruction by the arrival of high priority tasks.
commercial ones are a hindrance rather than help. They Preemptive scheduler has the power to pre-empt or
jack up the amount of memory and CPU resources that interrupt and resume other low priority tasks at a later
many embedded sensor nodes can’t handle. Here using time. Such a change is known as a context switch.
VM will be a big plus which needs no OS as an Information about each task, its relative priority, and
intermediary. the amount of stack space it requires must be provided
Squawk [6] is a Java virtual machine (JVM) for to the scheduler. Task priorities can be set in a variety
embedded sensor nodes. It is small Java 2 Micro of ways – even randomly. However, the rate
Edition (J2ME) virtual machine written almost entirely monotonic algorithm (RMA) is the optimal way to
in Java and runs without a RTOS on embedded ensure that key task deadlines are always met. When
hardware. Classes to be deployed onto the device are tasks share resources such as global variables, data
verified and transformed into Squawk's internal object structures, or peripheral control and status registers, an
representation, which is then saved onto a file called a RTOS primitive called a mutex must be used to
suite. Suites are then loaded into the sensor node prevent race conditions. Mutexes are an effective
device and are interpreted by the VM on-device. This means of preventing race conditions, but introduce the
allows for a smaller VM to be stored in the sensor possibility of priority inversions.
node, as well as faster start-up time for the node A preemptive kernel executes a special idle task
application. Mechanisms of garbage collection, thread when no other tasks are ready to run because all are
management and interrupt handling have special blocked waiting for events. Most kernels provide a way
implementations in Squawk in addition to standard to customize the idle task (using callback functions or
Java functionality. Interestingly the drivers are also macros), so that the transition to a low-power state can
written in Java, leaving a small portion of native code be conveniently implemented inside the idle task. The
implementation (Fig 5). Squawk also provides an main difference between a preemptive kernel and a
isolated mechanism by which an application is foreground / background system is that as long as tasks
are ready to run, the kernel does not switch the context
back to the idle task. Consequently the transition to a
low-power mode is much simpler, because it does not
need to occur with interrupts disabled.
Complexity of preemptive scheduler rises
significantly compared to a simple scheduler approach.
The memory costs of using a preemptive scheduler
include extra ROM for the system calls plus RAM for
task-specific stacks. Other costs are measured in lost
CPU time e.g. the scheduler is software that consumes
processor cycles. Context switches and clock ticks can
Figure 5 Architectural diff b/w Squawk Java VM and also consume a significant percent of the available
standard Java VM time, particularly if they occur frequently. Therefore
preemptive scheduler approach is right for large
represented as an object. In Squawk, one or more footprint wireless embedded network routers and
applications can run in the single JVM. Conceptually coordinator devices.
each application is completely isolated from all other 5.2. Layered Multithreaded And Network
applications. The performance penalty of using Java is Stack Architecture
mitigated by ever increasing power of today's 16/32-bit A critical aspect of a wireless sensor networking
MCUs. operating system is the manner in which user
There is another example of a VM approach from applications communicate with other nodes or routers
the TinyOS community [7], called Maté. It addresses and potentially to a network coordinator. Mantis
the problem of reprogramming sensor nodes, from Operating System (MOS) [8] is a next generation
lightweight OS designed specifically for WSN new developments in the hardware of the new smart
application. It is a classical layered multithreaded OS sensor chips, sensor nodes, wireless MCUs, new
with a layered network stack similar to a typical software solutions will become available. Hardware
TCP/IP stack. This network stack can be used to parallelism and new unleashed power will make the
communicate easily using the radio and / or the serial RTOS architecture for WSN even more compelling.
connection. The design of the MOS scheduler is based 10. References
on a pre-emptive, multi-threaded kernel for use in
WSN system. It achieves energy efficiency by [1] Anton Hristozov, “Choosing the best system software
implementing a sleep function. Its power-efficient architecture for your wireless smart sensor devices,”
scheduler recognizes when all threads are sleeping and Embedded.com, December 04,2007.
then sleeps the MCU for a duration deduced from each
thread’s sleep time. The API from the underlying OS [2] Frank Golatowski, Jan Blumenthal, Matthias Handy,
Marc Haase, Hagen Burchardt, Dirk Timmermann,“Service –
separates application threads. MOS enables cross- Oriented Software Architecture for Sensor Networks,”
platform support by preserving the API across Rostock, Germany: Institute of Applied Microelectronics and
platforms. Computer Science, University of Rostock.
In a nutshell MOS (Fig 6) achieves a lightweight
and energy-efficient scheduler, a user-level network [3] Micro Samek,”Use an MCU’s low-power modes in
stack as well as other components such as devices foreground / background systems,”Embedded System
drivers and compresses a classical multithreaded Design, October 2007.