- Forward


Mobile Agents
An Introduction with Examples in Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Definitions
Back SMYC Forward
  • In General:
    • People disagree about the definition of the term "agent" and the definition of the term "mobile agent"
  • For Our Purposes:
    • A mobile agent is an object that has the ability to move from host to host and execute one or more operations on each host
RMI vs. Mobile Agents
Back SMYC Forward
  • Remote Method Invocation:
    • An object on one host requests that an object on another host perform some operation
  • Mobile Agents:
    • The object itself moves from one host to another (i.e., the code to be executed moves between the hosts)
The Process
Back SMYC Forward

A UML Sequence Diagram

mobile_agent_sequence
Minimal Requirements for Mobile Agents
Back SMYC Forward
  • Serialization:
    • To be able to freeze an object it, transmit it, and unfreeze it
  • A Class Loader:
    • To be able to load the code required by an object
A Simple Implementation - States
Back SMYC Forward
  • An agent starts out in the NewAgent state
  • After being initialized, it moves into the BeforeDeparting state (and executes a series of operations on its "home" host)
  • It then moves to another host and enters the Arrived state (which can happen any number of times)
  • When it runs out of hosts to visit it moves to its "home" host and enters the ReturnedHome state
A Simple Implementation - States (cont.)
Back SMYC Forward
mobile_agent_states
A Sandbox for Mobile Agents
Back SMYC Forward

Using a Variant of the Strategy Pattern or Command Pattern

mobile_agent_sandbox
A Simple Implementation
Back SMYC Forward

The Sandbox

javaexamples/agents/Sandbox.java
 
A Simple Implementation (cont.)
Back SMYC Forward

The Sandbox Server

javaexamples/agents/SandboxServer.java
 
A Simple Implementation (cont.)
Back SMYC Forward

The Agent

javaexamples/agents/Agent.java
 
A Simple Implementation (cont.)
Back SMYC Forward

A Particular Agent - Kilroy

javaexamples/agents/Kilroy.java
 
Advantages of Mobile Agents
Back SMYC Forward
  • A Clear Case:
    • It is more "expensive" to transmit the data than it is to transmit the code; and
    • The code is complicated enough that it is difficult to indicate the operations that need to be performed using a "simple" protocol or scripting language
  • People Have Made The Following Arguments:
    • Mobile agents are appropriate for mobile devices because they: are only connected to the network intermittently, they tend to have low bandwidth, and they have limited storage/processing.
    • Mobile agents are appropriate for some searches because they are "closer to" the data and can "learn" about the data.
    • Mobile agents are appropriate for real-time interaction with remote hardware when latency of the communications network is high (e.g., space missions).
    • Mobile agents are appropriate when it is difficult to maintain the system state in other ways.
Extensions
Back SMYC Forward
  • Security:
    • Authentication of the agents and the hosts
    • The host must be able to determine what kinds of operations each agent is authorized to perform
  • Directory Services:
    • For finding hosts/sandboxes
    • For finding other agents (remote and local) to communicate with
    • For finding other objects (local) to communicate with
Extensions (cont.)
Back SMYC Forward
  • Class Loading:
    • Allow the agent to make use of multiple classes from multiple sources
  • Logging:
    • Have the host keep a log of the agents that use it (and how they use it)
There's Always More to Learn
Back -