Utf-8 Iit Documentation

  • Uploaded by: sudharsan2020
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Utf-8 Iit Documentation as PDF for free.

More details

  • Words: 3,970
  • Pages: 44
A COMPARATIVE STUDY OF OPERATING SYSTEMS FOR WIRELESS SENSOR NETWORKS

WIRELESS SENSOR NETWORKS: A wireless sensor network (WSN) is a wireless network consisting of distributed autonomous devices (say motes) which contains sensors to monitor environmental changes and these changes are communicated to a remote computer at regular intervals. MOTES: Mote is a tiny hardware device which consists of Sensors, Micro controller, Transceiver, Analog to Digital Converter and power supply. It is capable of gathering information and send/receive data from nodes in the wireless sensor network.

CHARACTERISTICS OF MOTES: Smaller in size Highly memory constrained devices Low power consumption Limited processing capacity

OPERATING SYSTEM FOR MOTES: Motes are simple hardware devices and they need to communicate with each other. For this we need an Operating System to establish communication with other motes.

Operating Systems are used in Motes to achieve the following features Efficient multi-tasking Networking Memory management Power management Process scheduling

Available operating system for motes is as follows:

TINY OPERATING SYSTEM

TINY OS: Tiny OS is a free open and open source operating system for Wireless Sensor Networks. It started as a collaboration between the University of California and Intel Research. Tiny OS is completely written using nesC programming language.

FEATURES OF TINY OS:

Component-Based operating system. Event driven Operating System. Tasks are non-preemptive and run in First In First Out(FIFO) order. Codes are linked statically. Application and Libraries are written using nesC, a programming language .

COMPONENT-BASED OS: COMPONENTS: Components can be defined as a functional part of a program that has a predefined service. The main advantage of using component based system is its enhanced reusability. Eg.Linux OS is an example of a component-based operating system .If you need an OS with only pdf viewer and media player, you can simply chop off unnecessary components resulting in a simple OS with only pdf viewer and media player.

EVENT DRIVEN OS: In Event driven OS,the flow of a program is determined by the sequence of events.Whenever an event occours,an interrupt signal is sent to processor and yhe interrupt is served with the corresponding Interrupt Service Routine. The main reason for using event driven model is to minimize power consumption.Tiny OS sleeps most of the time and only when the event occours it moves into active state.This ensures that Tiny OS doesn't consume most of the battery power. NON PREEMPTIVE SCHEDULING: Scheduling

determines

the

order

of

process

execution.In

NonPreemptive scheduling,the process which comes first,gets executed first.The processes are executed in First In First Out(FIFO) order. The main disadvantage of Non preemptive scheduling is process starvation.Even high priority processes must weight in queue to be executed.If a larger process is currently executing,all other smaller process in queue has to wait until the previous process has executed. NOTE:

The use of non preemptive scheduling does not affect the performance of Tiny OS significantly ,since the processes are Light weight. Processs starvation doesn't occur. No High priority process.

STATIC LINKING: In Static linking, all the library files are included in compile time and they are combined to form a single executable file. The main advantage of static linking is that they require less time for execution and the target platform need not contain the library files, since the library files are linked to form a single executable file. However Static Linking results in waste of memory, since the entire library is loaded into the memory during execution .Here is a comparison of dynamic and static linking stating the differences between them. STATIC LINKING

DYNAMIC LINKING

 Same code will be available  Single copy of code is available in both on Main memory and

the system.

system.  Memory space gets wasted.

 Programs use limited memory.

 Programs are executed much  Program execution is slower when faster

when

compared

to

compared to Static linking.

Dynamic linking  Program size is larger than a  Program size is smaller when dynamically linked program

compared to Static linking.

NOTE : Eventhough Dynamic linking is preferred to Static linking,in Tiny OS ,program size is very small and hence using Static linking does not have any adverse effect on Tiny OS performance.

nesC PROGRAMMING LANGUAGE :  nesC is a programming language for developing Tiny OS applications.  Tiny OS libraries are written using nesC programming language  nesC language is considered as an extension of C Programming language and its syntax are similar to C.  The building blocks of Tiny OS are Components, Configurations and Interfaces.

Let us discuss about them and how they are implemented using nesC. COMPONENTS:  Components are discrete units with a specified function.  Component can reference variables only from its local namespace.  Component must not only declare the function it implements but also declare the function it calls.  Every component has a specification. COMPONENT SPECIFICATION: Every component must declare not only the functions it provides (implements) but also the functions that it uses (calls). module SmoothingFilterC { provides command uint8_t topRead(uint8_t* array, uint8_t len); uses command uint8_t bottomRead(uint8_t* array, uint8_t len); }

Here the component SmoothingFilterC declares both the functions topRead(which it implements) and bottomRead(which it calls) from another

component.

The

components

are

wired

together

using

Configurations. CONFIGURATION:  Configurations are used for wiring (linking) the components to form a complete program.  Configuration must specify the components (to be wired) and has a predefined format.  Configuration can provide and use interfaces. CONFIGURATION SPECIFICATION:

configuration LedsC { provides interface Leds; } implementation { components LedsP, PlatformLedsC; Init = LedsP; Leds = LedsP; LedsP.Led0 -> PlatformLedsC.Led0; LedsP.Led1 -> PlatformLedsC.Led1; }

Here the configuration LedsC specifies the components LedsP and PlatformLedsC, which needs to be wired. The operator ”->” is used for wiring the components. The operator arrow ”->” points from user to provider.

INTERFACE:  Interface provides a set of functions that can be implemented by Components and Configurations.  Interfaces are bidirectional in nature. They provide a set of functions to be implemented by the inter-face’s provider (commands) and a set to be implemented by the interface’s user (events).  Interfaces decide the functionality of the component that it implements.

INTERFACE SPECIFICATION:

interface Send { command error_t send(message_t* msg, uint8_t len); event void sendDone(message_t* msg, error_t error); command error_t cancel(message_t* msg); command void* getPayload(message_t* msg); }

Here the interface Send provides the commands and events which needs to be specified by the interface-provider and interface-user respectively. Thus we have discussed the building blocks of Tiny OS programs like Components, Configuration and Interfaces.

CONTIKI OPERATING SYSTEM

CONTIKI OS:  Contiki OS is a open source and highy portable operating System for Wireless Sensor Networks.  Contiki OS was developed by Dr. Adam Dunkels at the Swedish Institute of Computer Science.  Contiki OS is developed for highly memory constrained systems. FEATURES OF CONTIKI OS:  Contiki OS provides a multitasking kernel.  Contiki OS comes with a Managed Memory Allocator to guard against memory fragmentation.  Contiki OS uses a preemptive scheduling technique for scheduling the processes.  Contiki OS processes uses extremely light weight threads called Protothreads.  Typical Contiki OS program requires minimum memory of 2KB RAM. MULTITASKING KERNEL: 

Multitasking is a method in which several CPU processes share same processing resources like Central Processing Unit.



Multitasking resolves concurrency problems by scheduling the processes.



Multitasking enhances the performance of the OS by reducing the execution time of a process.

MANAGED MEMORY ALLOCATOR: 

Managed Memory Allocator helps to guard against memory fragmentation.



Fragmentation refers to situation in which storage space gets wasted due to improper memory allocation.



Fragmentation can be classified into three types as follows 1. Internal fragmentation 2. External fragmentation 3. Data fragmentation

INTERNAL FRAGMENTATION: 

In internal fragmentation, storage space is allocated but it is never used.



Space remains unused inside the allocated region leading to inefficient memory management.

EXTERNAL FRAGMENTATION: 

In external fragmentation, memory space becomes unusable since its get divided into several small pieces over a period of time.



Reasons for external fragmentation can be attributed to poor memory management algorithms.



For example, in dynamic memory allocation, a block of 1000 bytes might be requested, but the largest contiguous block of free space has only 300 bytes. The memory allocation fails in this case.

DATA FRAGMENTATION: 

In data fragmentation, the piece of data in the memory is scattered into different pieces.



Data gets fragmented into many pieces in case of data fragmentation.

PREEMPTIVE SCHEDULING: 

In preemptive scheduling, the processes are scheduled on the basis of priority.



Whenever a high priority process comes in,the low priority process is temporarily preempted(interrupted) and the high priority process get executed.



The main advantage of preemptive scheduling is that high priority processes gets maximum attention and they need not wait.



However preemptive scheduling also leads to process starvation,since the low priority process needs to wait indefinitely until the high priority processes are executed.

PROTOTHREADS: 

Protothreads are lightweight, stackless threads used by Contiki OS processes.



Protothreads don't require their own stack rather all protothreads run on the same stack.



Protothreads are lightweight because they use very limited memory ( 2KB/protothread).



Protothreads do not make operating system call.



Protothreads provides a linear code of execution.

NOTE: 

Sharing a stack between the processes is impossible in order to avoid concurrency problems.



In general, every thread requires it's own stack for execution.



Protothreads provides linear execution and hence it becomes difficult to use conditional statements like if() and while() statements.

Thus we have discussed the features of Contiki OS like Managed Memory Allocator, Preemptive Scheduling and Protothreads.

SIMPLE OPERARTING SYSTEM (SOS)

SIMPLE OPERARTING SYSTEM: Simple Operating System(SOS) is an operating system wireless sensor networks developed by the Networked and Embedded Systems Lab (NESL) at University of California, Los Angeles. SOS currently supports Atmel-Atmega and Oki-Arm hardware platforms.

FEATURES OF SOS: 

SOS was developed keeping Dynamic Reconfigurability in mind.



SOS provides a convenient and a compact kernel interface.



SOS ensures safety through run time checks.



SOS provides a priority scheduling of processes.



SOS uses an event driven programming module.



SOS is purely written in C Programming language.

DYNAMIC RECONFIGURABILITY: 

Dynamic Reconfiguration enables us to modify the system during its runtime.



It is an important feature for WSN operating system,since we are able to modify the software module remotely without reaching the place where the device is deployed.



Basically in a WSN, the motes are scattered and hence it becomes difficult to identify the mote and reconfigure its operating system.



This problem can be solved using Dynamic reconfigurability.

APPLICATIONS OF DYNAMIC RECONFIGURABILITY: 

Applying patches and updates while OS is running.



Alter the software module, whenever it is needed.



Any 3rd party modules can be installed and reconfigured remotely.

COMPACT KERNEL INTERFACE: 

SOS provides a multitasking kernel that provides 1. Dynamic Memory Management 2. Garbage collection 3. Priority Scheduling

DYNAMIC MEMORY MANAGEMENT: 

Dynamic memory management refers to allocating and deallocating memory during run-time.



Garbage collection is a part of Dynamic memory management.



Garbage collection refers to removing the objects, which are no longer needed in a program and reclaim the memory.



Dynamic memory management increases the efficiency of programs and uses the memory efficiently.

PRIORITY SCHEDULING: 

Priority scheduling is a technique in which the processes are scheduled on the basis of priority.



Whenever a high priority process comes for execution, low priority process is preempted (interrupted).



A context switch is said to have occurred (ie) current state of the low priority process is saved in a Process Control Block (PCB).



Once the high priority process has finished executing, the state of the low priority process is restored from the Process Control Block (PCB) and the process starts executing from the state where it was originally preempted.



The main advantage of Priority scheduling is that high priority process doesn't starve and executed immediately.

CONCLUSION: Thus Simple Operating System(SOS) provides the following features 

Dynamic Reconfiguration



Multitasking kernel



Dynamic Memory Management



Garbage collection



Priority scheduling

From this we can infer that SOS offers exciting features for programming memory constrained, mote class Wireless Sensor Networks.

NANO-RK OPERATING SYSTEM

NANO-RK: Nano-RK is an operating system for mote class Wireless Sensor Networks developed by Carnegie Mellon University. Nano-RK currently runs on the FireFly Sensor Networking Platform as well as the MicaZ motes.

FEATURES OF NANO-RK: 

Nano-RK is a reservation based operating system.



Nano-RK has a multitasking kernel.



Nano-RK supports priority based preemptive scheduling.



Nano-RK enforces resource usage limitations.

RESERVATION BASED OS: 

Nano-RK enforces strict reservation policy.



In order to ensure that the process starvation doesn't happen, all the process must inform the Nano-RK Resource Kernel, in advance, regarding their memory and resource requirements.



Nano-RK kernel carefully monitors the resource usage for each process.



Only the process that haven't depleted their resource limits are eligible for scheduling.

PRIORITY BASED PREEMPTIVE SCHEDULING: In Preemptive scheduling, the process in a running state can be preempted by a process having a higher priority than the current process. In Nano-RK we use priority based preemptive scheduling where the higher priority process, can preempt (interrupt) the lower priority process and obtain access to the CPU. The main advantage of using priority based preemptive scheduling is to ensure that critical (high priority) processes doesn’t wait in a queue for execution. POWER CONSUMPTION: Nano-RK enforces power savings in order to maximize battery life. Nano-RK ensures that all the sensors are turned off (by default) to reduce power consumption. The power consumption of a typical FireFly Sensor node in active state is around 24mW. Thus Nano-RK is a reservation-based, energy-efficient operating system for highly resource-constrained sensor network environments. Nano-RK also supports multitasking and provides API for enhancing the ease of application development.

MANTIS OPERATING SYSTEM

MANTIS OS: Mantis is the acronym of MultimodAl system for NeTworks of In-Situ wireless Sensors. Mantis OS originated as a WSN project at the University of Colarado. Mantis OS is purely written using C Programming language. It is energy efficient OS for mote class Wireless Sensor Networks.

FEATURES OF MANTIS OS: Mantis OS supports Dynamic Reprogramming. Mantis OS uses priority based round robin scheduling. Mantis OS consists of a multithreaded kernel. Mantis OS has a very small memory footprint. A simple Mantis OS program requires only about 500 Bytes of RAM. Mantis OS is a highly energy efficient OS and consumes about 20 mA current in active state. MULTITHREADED KERNEL: Multithreading ensures that several threads of processes can share the same CPU resource. Multithreading does not mean that several threads run at the same time because CPU executes only one thread at a time. Since the processor can execute multiple threads within a given time period, is referred to as Multithreading.

Consider a process having a clock speed of 3.33GHz, then the time of execution of a thread is approximately 300µs. Multithreading implies that a processor can execute several processes within a given time slice.

PRIORITY BASED ROUND ROBIN SCHEDULING: Round Robin Scheduling algorithm specifies a time quantum for each process. All the processes are expected to complete their execution within the given time quantum. If the process doesn’t complete its execution within the specified time quantum, the process gets preempted and it is sent to the tail of the queue. Each process must repeat this, until it is completely executed. However, in Mantis OS we use a priority based round robin scheduling. Round Robin Scheduling is considered as one of the best scheduling algorithms, since it ensures fairness in process scheduling and all the process gets access to their resources. However, there is a memory overhead in Round Robin Scheduling Algorithm is considered as undesirable. Memory overhead occurs in Round Robin Scheduling Algorithm due to the following reasons

 Once the time quantum of a process is over, the process is preempted (interrupted) and sent to the tail of the queue.  As a result, the current state of the running process (context) must be saved in a Process Control Block (PCB), in order to restore the state of the process after some period of time.  As a result of frequent context switching, the states of the preempted process must be saved frequently in the Process Control Block.  This results in a memory overhead involving saving and restoring the context of the threads. The only difference in priority based Round Robin scheduling than that of normal Round Robin scheduling is that the processes are served on the basis of their priority.

ILLUSTRATION: Consider the following table stating the processes, their priority along with their Service Time.

PROCESSES

PRIORITY

SERVICE TIME

P1

1

4

P2

2

6

P3

3

2

P4

4

4

TIME QUANTUM=2µs

The process of Round Robin scheduling can be illustrated with the help of Gantt chart. P1 0

P1 2

P2 4

P2 6

8

P2

P3

P4

12

14

10

P4 16

Here the process is P1 preempted after the given time quantum and sent to the tail of the queue. But how process P1 immediately comes to the execution? It should have been actually executed only after P4! P1

P1

P2

P2

P2

P3

P4

P4

The answer for the above question is priority (because process P1 has highest priority). Similarly other processes namely P2, P3 and P4 are executed on the basis of priority.

DYNAMIC REPROGRAMMING: Mantis OS provides remote management feature through dynamic reprogramming. Dynamic Reprogramming is an feature for Wireless Sensor Network OS for the following reasons  Mote devices used in Wireless Sensor Network are deployed in remote areas, which may remain inaccessible to humans.  Whenever we need to modify a software module, it becomes impossible to locate the mote and then modifying its software components.  There we need dynamic reprogramming, inorder to ensure remote management of Wireless Sensor Network nodes. Mantis OS offers two modes of programming for the purpose of dynamic reprogramming.  SIMPLER PROGRAMMING In simpler programming, the user simply connects the PC directly to the Mantis node used in the Wireless Sensor Network. The user simply connects the node to a PC and opens the MANTIS shell. MOS enters a boot loader that checks for communication from the shell. The OS gets directly downloaded to the MOS mode and the node is updated.

 ADVANCED PROGRAMMING: In this mode, the node doesn’t require a direct connection with the computer. Dynamic Reconfigurability capability is actually implemented as a system call library, which is built into the MOS kernel After the call, the code is downloaded and stored in a flash memory. The software is completely reset and the reprogramming is done. Dynamic Reconfigurability is usually performed by establishing a remote connection with the node in the Wireless Sensor Network.

The support for Dynamic Reconfiguration is in progress and yet to attain a stable state. Thus Mantis OS provides a support for Dynamic Reconfiguration providing a remote management facility to the user and uses an efficient Round Robin Scheduling algorithm.

SUN SMALL PROGRAMMABLE OBJECT TECHNOLOGY

SUN SPOT: SUN Small Programmable Object Technology is an Operating System for Wireless Sensor Network developed by Sun Microsystems. SUN Small Programmable Object Technology is deployed in a device called as Sun SPOT device.

Sun SPOT device is a small and wireless device developed by Sun labs. Sun SPOT device is Java platform wireless device and they are programmed purely in Java.

SUN SPOT DEVICE: Sun SPOT devices are the target platform for Sun SPOT Technology. Sun SPOT devices are programmed in Java and any java program needs a virtual machine for execution. Squawk Virtual Machine is an open source Java virtual machine for highly resource constrained Wireless Sensor Networks. The main advantage that Sun SPOT is that, it is programmer friendly. The programmer can use the native Java tools for developing applications for Sun SPOT device. Sun SPOT provides a Software Development Kit, providing the API and hence programming the Sun SPOT device becomes easy.

SUN SPOT FEATURES: Sun SPOT uses a compact Squawk Virtual Machine. Sun SPOT is the only operating system for Wireless Sensor Networks that comes with inbuilt security feature. Sun SPOT uses Elliptic Curve Cryptography(ECC) for ensuring the security of the data packets shared across the nodes in the Wireless Sensor Network Sun SPOT has a Garbage Collector and it ensures automatic memory management. Sun SPOT is easy to program, since it is facilitates the user to code the programs using the familiar Java Programming Language.

SQUAWK VIRTUAL MACHINE: Squawk Virtual Machine is an open source Java Virtual Machine developed by Sun Microsystems. The specialty about the Squawk Virtual Machine is that it is majorly (not fully) written using Java Programming Language. Squawk Virtual Machine outputs a very compact byte code. The original output byte code is only about 35-40% of standard J2ME class file. Squawk Virtual Machine uses a Garbage Collector for managing memory. Squawk Virtual Machine uses a green threading model, in which the processes are scheduled purely by the Virtual Machine and not by the Operating System.

GREEN THREADING MODULE: In green threading module, the green threads (threads) are scheduled by the Virtual Machine and not by the underlying Operating System. Generally the virtual memory can be differentiated into User Space and Kernel Space.

Green threads are managed in the User Space and they do not rely on the underlying OS. In fact, Operating System does not know about the Green threads. Green Threading model uses priority scheduling to schedule the green threads. The main advantage of using green threaded model is due to the following reason 

Reduces the overhead on OS, since the Virtual Machine takes care of scheduling the green threads.



Enhances the portability of a program ,since the green threads doesn’t depend on the Operating System and they purely rely on Virtual Machine

GARBAGE COLLECTOR: Garbage collection is a memory management feature present in Squawk Java Virtual Machine. The term “garbage” refers to the unused objects (or they are no longer needed) in the Java program. Whenever the object is no longer referenced by the program, then the heap space it occupies must be freed. Garbage Collector must determine the unused object and reclaim the free space. Hence the Garbage Collector is not only responsible for automatic memory

management

but

also

guard

against

memory

fragmentation (inefficient usage of memory space).

Thus we have discussed the features of Sun SPOT like Green Threaded Model, Squawk Virtual Machine, Garbage Collection and Preemptive Scheduling.

COMPARATIVE STUDY OF OPERATING SYSTEMS FOR WIRELESS SENSOR NETWORKS

POINTS OF COMPARISON: Supported Hardware Platforms Nature of Operating System Nature of Scheduling Nature of Programming Language Dynamic Reconfigurability Garbage collection

SUPPORTED HARWARE PLATFORMS: TelOS

Mica2 Mote

ESB

TMote

Atmel-

Oki

Fire

Sun

Sky

Atmeg

Arm

Fly

Spots

a TINY OS CONTIKI OS SOS

NANO-RK

MANTIS

SUN SPOT

NATURE OF OPERATING SYSTEM:

EVENT-

MULTITASKING

DRIVEN

OS

OS TINY OS CONTIKI OS SOS NANO-RK MANTIS SUN SPOTS

NATURE OF SCHEDULING: NON

PRIORITY

PREEMPTIVE SCHEDULING SCHEDULING

TINY OS CONTIKI OS SOS NANORK MANTIS SUN SPOTS

ROUND ROBIN SCHEDULING

PROGRAMMING LANGUAGE:

nesC TINY OS CONTIKI OS SOS NANO-RK MANTIS SUN SPOTS

C

JAVA

DYNAMIC RECONFIGURABILITY:

DYNAMIC RECONGIGURANILITY TINY OS CONTIKI OS SOS NANO-RK MANTIS SUN SPOTS

GARBAGE COLLECTION:

GARBAGE COLLECTION TINY OS CONTIKI OS SOS NANO-RK MANTIS SUN SPOTS

CONCLUSION: Thus we have discussed following operating systems for Wireless Sensor Networks

We have also discussed the salient features of these operating systems like Nature of operating System Nature of Linking Nature of Process Scheduling Nature of Programming language.

Each Operating System has its unique feature and they have their own merits and demerits. However the operating systems for Wireless Sensor Networks are gradually evolving to attain stability and security.

Related Documents


More Documents from ""

Utf-8 Iit Documentation
December 2019 5