Use of Virtual Machine for Distributed Computing in Sensor Grids

Wireless Sensor Networks (WSN) has become highly attractive subject area among researchers due to its wide area of uses. WSN can be viewed as a distributed computing infrastructure as different sensor nodes contains computing capabilities and are connected to each other via network. Since sensor nodes have limited hardware capabilities, it is a viable option to use distributed computing paradigm to perform complex operations on the network. The combination of distributed computing and WSN has led to new field called sensor grids which assists in distributed decision making. Most of the current operating systems for the sensor nodes does not have the inbuilt capability to perform distributed computing on the network. This paper proposes a use of virtual machine to provide a common interface for development of distributed applications.


Introduction
A wireless sensor networks (WSN) is a collection of small low powered devices with sensors called 'mote' which work collectively using wireless communication to monitor physical or environmental conditions.The development of WSN was initially carried out for military use but later gained wide spread interests due to its high potential use cases in civilian life.The application of wireless sensor networks have wide range including industrial monitoring, smart agriculture, natural disaster prevention etc. Figure 1 shows the common uses of wireless sensor networks.
Using the paradigm of distributed computing is highly effective to use in WSN as the sensor nodes are not equipped with hardware's to perform complex operations [1].Also, the fact that computing the data between the nodes before relaying the information to the base station is better option to conserve energy.The concept of sensor grid arises when sensor data are effectively computed in a distributed manner and actuators works based on the result of such computation.Figure 2 shows a general architecture of a sensor grid.
Standard methods like data acquisition [2] require some sort of distributed computing architecture.Even though WSN 's architecture resembles distributed computation model, it is very difficult to effectively implement the same.Traditional model for distributed computing does not apply to the WSN.The major problems faced while developing distributed applications for WSN are: 1) Heterogeneity of hardwares: WSN hardwares have a heterogeneous nature.The devices used as motes have different specification in terms of hardwares and depends entirely on use case and vendors.Motes are known to compromise on different features to make it suitable for specific needs.Some hardwares like sun-spot contains 512kb of RAM and 4mb flash storage while some hardware contains only 4kb of RAM or 64kb flash storage.Therefore, writing a distributed application to support all of these hardwares is a tedious task.
2) Unreliable Communication: WSNs are usually deployed in an ad-hoc manner and networks are subjected to dynamic growth and shrinking.The main reasons are application growth, device failures and physical obstacles.Since the communication system should support this dynamic network topology, the reliability is not guaranteed.
3) Limited Resources: A network communication between the nodes is usually very expensive in terms of resources.Classical architecture for distributed computing relies heavily on network communication which is a sparse resource in a typical WSN. 4) Lack of software support: Typical operating system built for WSN does not have an inbuilt support for distributed computing programming model.An application developer is left with a tedious task to do everything from the scratch which results in error prone and difficult to debug application.
This paper especially focuses on providing answers to the lack of software support problem.We propose use of virtual machine to provide common interface for distributed application programming.The virtual machine abstracts away different hardware's and operating system relieving users to understand Engineering Technology Open Access Journal low level implementation of distributed computing interfaces.Programming on the virtual machine makes it easy for developers to write application of distributed nature geared towards nodes of the network (Figures 1&2).

Motivations for use of virtual machine
Virtual machines (VM) are known to provide virtual abstraction of the hardware and has ability to execute bytecode interpretation of the application code.There are number of reasons why virtual machine approach is suitable to be used as a middleware in WSN.First, the hardwares of WSN has been evolving like never before resulting in more heterogeneous platforms.Virtual Machines provide common runtime environment for these hardwares resulting in transparent platform independent code.Thus, VM approach is more application developer centric in nature.Secondly, VM approach also makes it easy for application developer to program a mote by providing useful arsenal of tools.Programming features such as multi-threads, memory management, code safety and debugging etc. are harder to realize in low level languages used to program a mote but VM approach has the ability to provide such features to the developers.Thirdly, VM provides ease of reprogramming the motes which is an important requirement for WSN.VM can provide compact software update resulting in more flexibility and reduced communication overhead.The reduction of communication overhead results in lower energy consumption.Lastly, all the above features come at a cost i.e tradeoff in execution speed and memory overhead.But the efficiency of WSN technology relies little in those tradeoffs making virtual machines an attractive option to be implemented as a middleware.
The next section contains previous work on virtual machines for WSN.After that we shall discuss the proposed architecture.We shall then discuss its advantages and then conclude.

Related Work
There have been many virtual machines proposed a developed targeted WSN platform.Levis et al. [3] introduced mate virtual machine which is probably the first ever virtual machine proposed for sensor nodes [4].It is basically a bytecode interpreter built on top of tiny OS.It is mainly focused on ease of reprogramming by breaking the program into capsules of 24-byte length.The mate has also been evolved to use in application specific domain.The virtual machine only specifies byte-code specifications and does not provide any high level programming methods.A application developer has to program everything by his own to write any kind of distributed application in it.
Swiss QM [5] is a bytecode interpretor which defines its own instruction set independent of application language.Though effective, the VM is mainly focused on query based data acquisition rather than effective programming support.Magnet OS is a system level virtual machine which focuses on power aware adaptability to changing network topology [6].The focus of this VM is mainly to reduce communication overhead rather than abstracting the system for application development.Apart from aboce virtual machine there are many Java Virtual Machines developed targeting the embedded devices platform.Some of them are lejos [7], simpleRTJ [8], nanoVM [9], Jwik [10], Java Card VM [11].Though most of them are highly effective platforms, they don't specifically target WSN platform.They are mainly general purpose JVM platforms that could be used in fields of different domain than WSN.We also want to make sure that virtual machine under review is freely available as open source software rather than proprietary.We propose a virtual machine which can execute Java byte codes on sensor nodes.The virtual machine is responsible to manage the real-time data and information flow between the nodes.The real-time data flow helps the grid to make decisions on the fly.The virtual machine only manages the query and processing

Engineering Technology Open Access Journal
which are of distributed nature.All other normal operations are executed by the native OS.This approach makes sure that there are no overheads for simple operation of the node.Figure 3 shows the position of the virtual machine in the sensor nodes.

Message queue
The virtual machine manages the network and maintains a message queue.The message queue operates in a priority basis.Any distributed processing commands is inserted in the message queue of the node by other nodes.The virtual machine then processes the message based on the priority.The high priority messages are usually the real time messages which needs instant processing.The low priority messages are usually the broadcasts or notifications.The priority of any other types of messages could be specified by the user.Figure 4 shows basic structure of message queue.

Data aggregation strategy
To reduce the frequency of sending information's in the network the virtual machine usually aggregates information and sends most of them at once.This reduction helps in power consumption of the device as storage is usually an ample resource when compared to battery.
Other than above basic functionality the virtual machine is also responsible for fault tolerance and prevention.It manages coordinator selection using bully algorithm in case of communication failure between the nodes.The virtual machine is also responsible for synchronization of data if required [12].

Discussion
As shown earlier we have implemented the virtual machine as an extension rather than tightly couping it to an existing system.The virtual machine can be implemented on top of any host or operating systems that supports WSN.The implementation of message queue makes sure that urgent and high priority works are performed ahead of other normal works.The data aggregation strategy makes sure that optimum utilization of power resources is carried out.Due to common application programming interface, we expect the development time to reduce significantly with the use of VM.

Conclusion and Future Work
This paper presents a concept of using virtual machine to assist in distributed applications programming in wireless sensor nodes.We presented a simple architecture where virtual machine handles everything related to distributed computing.The message queue architecture makes it flexible to prioritize works in different categories.All the low-level problems of distributed systems like synchronization, fault tolerance, hardware communication etc. are handled by virtual machine.This paper presents a theoretical concept.In the future we would like to implement the discussed architecture and test its usability in a real-world scenario.

Figure 2 :
Figure 2: General architecture of sensor grid source.

Figure 3 :
Figure 3: Position of VM in the node.