Developing applications for ad hoc and sensor networks poses significant challenges. Many interesting applications in this domain entail collaboration between components distributed throughout an ad hoc network. Defining these components, optimally placing them on nodes in the ad hoc network and relocating them in response to changes is a fundamental problem faced by such applications. Manual approaches to code and data migration are platform-dependent and error-prone. Furthermore, locally optimal decisions made by individual applications can lead to globally unstable and energy inefficient behavior.

MagnetOS is a distributed operating system for ad hoc and sensor networks whose goal is to enable power-aware, adaptive, and efficient ad hoc networking applications. The system achieves this goal by providing a single system image of a unified Java virtual machine to applications over an ad hoc collection of heterogeneous nodes. It automatically and transparently partitions applications into components and dynamically finds a placement of these components on nodes within the ad hoc network to reduce energy consumption and increase system longevity. MagnetOS consists of a static code partitioning service and a local runtime that supports the partitioned applications.

The code partitioning service operates by dividing Java applications into components that can migrate and execute over a network. This division is performed statically along object interfaces at class granularity, which preserves class interfaces, retains type safety, and works at the bytecode level without requiring source access. Partitioning applications involves two separate modifications. Object creation instructions are replaced by calls to the local MagnetOS runtime, which is responsible for selecting an appropriate node and creating a new instance of the object on that node. Object invocations are modified to go through an RPC mechanism to invoke remote objects, and MagnetOS uses the Java RMI interface for remote object invocation.

Two novel practical, power-aware, online algorithms, NetPull and NetCenter, form the core of the MagnetOS system. They profile the communication pattern of applications in discrete time units and decide, based on local information, where to move the application objects. NetPull profiles communication at the physical link level, and migrates components over physical links one hop at a time in the direction of greatest communication. NetCenter operates at the network level, and migrates components multiple hops at a time directly to the host with which a given object communicates most. By moving communicating objects closer together, these algorithms shorten the mean path length of data packets. Moving application components from node to node also avoids communication hotspots. Both algorithms can increase system longevity by a factor of four to five. In addition, these migration policies improve energy utilization, network connectivity and scalability.

In summary, MagnetOS provides a single system image over an ad hoc network using transparent code partitioning as a mechanism and NetPull and NetCenter as code migration policies. The resulting system executes applications in an efficient, adaptive, scalable, general purpose and platform-independent manner.

Computer Science Department
Cornell University