Pervasive computing is now a reality with the massive deployment of mobile  appliances, particularly smart phones. Well-established pervasive applications include  home automation, healthcare monitoring, and the intelligent city. These  applications are starting to significantly impact society and the economy by bringing  electronic commerce to everyday objects, by decreasing homepower consumption and by  improving human safety.

Despite the increasing importance of pervasive applications, providing adequate support for  them within a computing environment remains a challenge. Pervasive applications vary  greatly in their resource requirements (processors, memory,bandwidth, and disks): for  critical applications, such as surveillance systems, a known bounded amount of resources  must be guaranteed for the application to run properly; for multimedia applications, the  amount of resources needed may change over time and dynamic adaption is often required.  To manage these differing and possibly varying resource requirements, a system of resource  reservations is required. Because the availability of resources is global to a computing  environment, such reservations have to be managed at the middleware level.

Modern pervasive middleware is typically implemented using Java, for  example with OSGi or Android, because of its safety, flexibility, and mature  development environment. In fact, Java is the most used programming language today.  However, the Java virtual machine specification has not been revised since 1999, at the  time when the idea of pervasive computing was first introduced. It was designed to  execute only a single application at a time, and thus it does not provide resource accounting  or per-application resource reservations.Current pervasive middlewares are thus unable to  reserve resources for critical applications, which may cause these applications to crash or  hang when insufficient resources are available, and are unable to provide resource  accounting, making it impossible to balance the load on the devices and to optimize resource  use.

The Infra-JVM project will investigate how to enhance the design of Java virtual machines  with new functionalities to better manage resources. We have identified three key  functionalities for which the Java virtual machine does not provide an adequate interface or  for which the current implementation is a bottleneck:

  • Resource reservation: the Java virtual machine was not targeted to support more  than one application. It does not provide a per-application resource accounting and  reservation for memory, bandwidth, disk, etc. We propose to define the notion of  resource container inside the Java virtual machine able to account and reserve  resources on a per-application basis.
  • Scheduling policies: the Java virtual machine provides a time-sharing scheduler that  is unable to accept CPU reservations and is unable to anticipate dependencies  between applications. We propose to define a new language to allow the pervasive  middleware to define its own scheduling policy, in terms of the applications that it  executes.
  • Resource optimization at the middleware level: Optimally placing applications on  devices requires resolving a number of conflicting constraints. Constraint solving  requires searching through a state space, which is typically implemented using a  backtracking algorithm that induces frequent saving and restoring of memory states.  However, intensive memory copy is known to be a bottleneck on modern  architectures that have complex cache hierarchies. Furthermore, copying objects in  Java can only be implemented at the field level, which prevents the use of well  known low-level optimizations. We proposeto extend the Java virtual machine with  an efficient memory snapshot mechanism that relies on page-level protection  mechanisms provided by modern hardware and OSes.

Our visionis that the Infra-JVM willimplement resource management mechanismsin a way that existing pervasive middlewares and applications can use them with little or no modification.We will provide a notion of resource container to account and reserve resource, independently of the pervasive middleware. At deployment time, the pervasive middleware will configure the resource containers by loadinga XML file describing the requirements in  term of criticality, scheduling policy, amount of memory, amount of bandwidth and amount  of disk. Before loading a critical application, the pervasive middleware will verify that requested resources are available. For other applications, the middleware will just provide a
best-effort policy. Then it willuse thecontainer to manage resource accounting and reservations for an application in theJava virtual machine, and will use the constraint solver to optimally balance the load between the devices and to guarantee enough resources for critical applications.
To prototype these functionalities, the Infra-JVM project will rely on the previous work of the Regal team on VMKit. VMKit provides the core of a managed runtime  environment (MRE), allowing new managed environments to be rapidly developed. VMKit  has been successfully used to develop a .Net virtual machine and a Java virtual machine,  both having performance comparable to that of the well-established open source MREs  Cacao, Apache Harmony and Mono. The experience that we acquired during the  development of VMKit is key enabler for the success of this project.  As a result of the project, we will propose a new Java virtual machine prototype based on  VMKit that will integrate functionalities for resource accounting and reservation, for application-driven scheduling,and for memory snapshots. We will evaluate this prototype on a pervasive end-to-end experimental use-case provided by the Triskell team. This use-case is an information system that allows real time communication and coordination between firefighters and various command positions.It executes on OSGi,  a Java component-oriented framework that targets pervasive computing. This use-case contains critical applications that require resource reservations and global load  balancing. Under the current Java virtual machine, the critical application aborts because it  lacks resources, and the overall performance is poor because OSGi’s components are  inefficiently placed and scheduled. To ensure the availability of adequate resources, the use  case will rely on the advanced resource reservation functionality. To provide resource  optimization at the middleware level, we will use the Choco constraint solver provided by the Constraint team. Choco is written in Java and its performance will be  improved using the memory snapshot mechanism that we will develop. The success criteria are: an improvement of application performance thanks to the load  balancing mechanism, and a guarantee that critical applications always have enough  resources to execute. The Infra-JVM must also not degrade applications that do not use the  new functionalities, making it possible to propose to integrate the approach into industrial  Java virtual machines.