## 3 Middleware for WSN Virtualization
### Middleware for Sensor Virtualization
Servilla allows application logic to execute inside the network that provides high level of efficiency and in network coordination. The services are platform specific, but the tasks are platform independent. Servilla is implemented in TinyOS using NesC that provides two programming languages 'ServillaSpec' and 'ServillaScript'. They provide a high level of abstraction like JavaScript. Servilla consists of virtual machine that enables execution of application tasks on heterogeneous devices, tasks communicate via local tuple spaces like in Agilla. The other main module is the service provisioning framework that is further divided into consumers and services providers. Furthermore, the consumers consist of service finder, service scheduler and binding table: and the provider part contains service registry, remote invocator and the service discovery. They are responsible for updating the available services both at the consumer and service provider's part. In Servilla services are platform specific but the tasks are platform independent. Services are responsible for binding and invocation. To increase flexibility, the tasks having fewer matches are even bind to the services. Service discovery and binding are made energy efficient. Servilla believes that the services that require high computation cost should be executed on resource rich devices. High computing services should only be invoked when required, for example, in structural monitoring application; damage localization service should be invoked when cracks are sensed. On the other hand normal cyclic monitoring services should be carried out by the resource poor devices like sensing the cracks. Furthermore, results shared by servilla show that increase in sensing frequency of the resource poor devices and invoking heavy services of resource rich devices only when needed resulting in an overall energy efficient network. **PRESTO**[50] middleware is based on predictive proxy centric technique. It is based on the storage architecture for large scale sensor networks. The novelty lies in the middleware predictive technique. The database approach used ensures that the data should be processed, filtered, interpreted and cached in an efficient manner, the proposed technique is inspired by the primary work of COUGAR [51] and TinyDB [52]. There are two main data acquisition models first where the query is pushed directly to the sensor, this is more energy efficient [53] however, provides high latency, low reliability and low availability. The second method is where potentially useful data is pushed from the sensors to the sink, powerful device (gateway) or a database server [54]. The second model is adopted by PRESTO. The cleaning of the data is performed at the database server, thus providing lower latency, better interaction and reliability. The drawback of the model is that it is less energy efficient as unwanted data is always coming in at the database, therefore PRESTO varies the duty-cycling parameters to decrease the energy usage. PRESTO middleware caches the current and the past data from the sensor nodes and use predictive techniques on the cached data. Therefore, provides complete support for the real time systems. PRESTO middleware also extrapolates the lost data, this helps in more cache hits. In case of a cache miss there is a significant processing involved in answering the query, this could lead to significant delay. PRESTO middleware rather than sending the raw data sends only the information or summary the data cache, which can further be refined on the proxy this leads to minimize the delay of the query processing. Albeit, PRESTO is effective in a number of applications, but the predictive sensing model could be inadequate while dealing with the sensitive applications like health monitoring or chemical plant monitoring.