• No results found

Mobile Agent systems.pdf

N/A
N/A
Protected

Academic year: 2020

Share "Mobile Agent systems.pdf"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

Distributed System

(2)

What’s an Agent?

Definitions:

“An autonomous process capable of reacting to and initiating

changes in its environment, possibly in collaboration with users

and other agents”

(3)

Agent Types and Characteristics

collaborative agent: collaborate with others in a multi-agent system • mobile agent: can move between machines

interface agent: assist users at user-interface level

(4)

Stationary and Mobile agent

Stationary Agent

– Executes only on the system where it begins execution

– If it needs information on another system, or needs to interact with an agent on another system, it uses a standard client-server communication mechanism such as RPC,RMI,DCOM,CORBA

Mobile Agent

– Not bound to the system where it begins execution

(5)

Examples of Agent Applications

User-interface agents

– Microsoft Office Assistant – Microsoft Agents

Personal assistants

– Calendar managers – Investment assistants

Electronic commerce agents

– Travel agents – Shopping agents – Auction agents

Network management

Information management agents

– Web browsing assistants – Notification agents

(6)

What is a Mobile Agent?

Mobile agents are a

distributed computing paradigm

A mobile agent

migrates

from one machine to another

under its

own control

Decides which locations to visit and what commands to

execute

Continuous interaction with the original source is not required

(7)
(8)

Levels of Mobility

Evolution of Mobile Agents

– Mobile code = transfer of code

– Mobile objects = transfer of code + data

– Mobile process = transfer of code + data + thread state

– Mobile agent = transfer of code + data + thread + authority of its owner

Weak Mobility

– Mobile agent carries code and data. Execution has to start from beginning after transfer

– Data state = global state

Strong Mobility

– Mobile agent carries code, data and execution state – Data state = global state

(9)

RPC Vs Mobile Agents

Remote Procedure Calls (RPC)

– One computer calls procedures on another

– Messages: Requests and Responses

– Procedure is “remote” – i.e. it is local to the machine that

performs it

– Client and Server agree in advance on the protocol for

communication

– Continuous on-going interaction and communication

between the client and server

(10)

RPC Vs Mobile Agents

Mobile Agents

– Instead of calling a procedure, supply the procedure as

well

– Messages: Mobile Agent ( procedure + data + state)

– “Sending” computer may have begin the procedure and

the receiving computer will continue the procedure

– On-going interaction, but NO on-going communication

Client

Mobile

Agent

Service

(11)

Applets, Servlets and Mobile Agents

Applet

– Downloaded from server to client

Servlet

– Uploaded from client to server

Mobile Agents

– Detached from client, can have multiple

(12)

The Advantages of Mobile Agents

reduce bandwidth consumption and network loads

allow dynamic deployment of application components to arbitrary

network sites

execute asynchronously and autonomously

can adapt by moving

run on heterogeneous platforms

most distributed applications fit naturally into the mobile agent

model

intuitively suitable for mobile users and disconnected operations

(13)

Mobile Agent Toolkits

Provide the infrastructure for mobile agents ...

– to interact with a local computer system; this is known as a “context”

for mobile agents to reside and execute – to move from host to host

– to communicate with other agents and hosts through message passing

– to maintain privacy and integrity (of agents as well as hosts)

These toolkits are normally Java-based e.g.

– Aglets

– Concordia – JADE

– OAA

(14)
(15)

Agent Server

The Agent Server provides an execution environment for the

mobile agents

It provides the following services:

– Authentication of incoming agents

– Agent dispatching and receiving services – Agent communication services

(16)

Languages for Mobile Agents

To provide platform independence we need a scripting or

interpreted language

Java is an excellent choice!

– Platform independent

– Secure execution via byte-code verifier and security manager – Dynamic class loading over network

– Object serialization for agent transport

Other Languages

(17)

Aglets

Java based mobile agent toolkit developed by IBM

– The name originates from Aglet =Agent + Applet

Aglet properties:

Mobile Java object that can visit Aglet enabled hosts

 Executes in a Context; there may be many contexts on a node

 An Aglet server hosts N contexts

 Aglet = Aglet state (variable values) + Aglet code (Java class)

 Autonomous

 Runs in a separate thread when it arrives at a host

 Reactive

 Responds to messages that are sent to it. A message is an object exchanged by aglets

 Message passing is synchronous and asynchronous

 Is unique

 A globally unique identifier is bound to each aglet

(18)

IBM’s Aglet Mobile Agent System

System elements:

host, engine, context, proxy, aglet

Aglet Transfer Protocol

e.g. “atp://hostname:port/context/”

AgletID:

system-given globally unique identifier for life

aglet

proxy

proxy

aglet

context

aglet

proxy

proxy

aglet

context

(19)

Aglet: the mobile Java object

Proxy: representative of an aglet.

 Shields and protects an aglet from direct access to its public methods  Provides location transparency for the object

Context: an aglet’s work place.

 A server can have several contexts.  Named

 Stationary

Message: objects exchanged between aglets

(20)

Aglet Operations

Creation

– Create a new aglet in a context and start its execution  Cloning

– Create a copy of an aglet, with a unique ID  Dispatching

– Send an aglet to another context, either locally or on a new host  Retraction

– Pull an aglet from its current context back to the requesting context  Deactivation/ Activation

– Halt and restart the aglet’s execution  Disposal

(21)

The Aglet Lifecycle

Aglet

Aglet

Class

File

Storage

Disk

Context One

Context Two

Clone

Dispatch

Retract

Dispose

(22)

The Aglet Programming Model

Event based programming model

– Aglets have listeners which catch events in the lifecycle of the aglet  Clone Listener

• About to be cloned, after cloning

 Persistence Listener

• After activation, or about to be deactivated

 Etc..

– MobilityListener – Interface for receiving mobility events

onDispatching(mobilityEvent)

• Invoked when aglet is being dispatched

OnReverting(mobilityEvent)

• Invoked when the aglet is being retracted

onArrival(mobilityEvent)

• Invoked when aglet has arrived at its destination

You override these methods

(23)

Aglet Creation and Management

Aglets are created and managed per context

– The Context API interface AgletContext

 CreateAglet(CodeBase, ClassName, Args); returns a proxy to the created aglet

 Others: getAgletProxy, getAgletProxies, etc..

You manage an aglet by calling methods on the proxy using

the Aglet API interface

AgletProxy

– This can be done remotely (so a proxy is similar to an RMI stub) – Clone() – Create a copy of this aglet

– Dispatch(destination) – Send the aglet to a destination

– Dispose() – destroy the aglet

(24)

Writing an Aglet

import com.ibm.aglet.*;

import com.ibm.aglet.event.*;

public class HelloWorld extends Aglet {

public void onCreation(Object init) { setText("Hello World.");

(25)

Simple migration

public class HelloAglet extends Aglet {

public void atHome(Message msg) {

setText("I'm back.");

dispose();

}

public void onCreation(Object init) {

setMessage("Hello World!");

itinerary = new SimpleItinerary(this);

home = getAgletContext().getHostingURL().toString();

}

public void sayHello(Message msg) {

setText(message);

try {

itinerary.go(home, "atHome");

} catch (Exception ex) {ex.printStackTrace();} }

When I arrive home – delete myself

When created, setup an Itinerary (where to go)

(26)

/* Starts the trip of this aglet to the destination */

public synchronized void startTrip(Message msg) {

// get the address for trip

String destination = (String)msg.getArg();

// Go to the destination and Send "sayHello" message to

owner(this)

try {

itinerary.go(destination, "sayHello");

} catch (Exception ex) {

ex.printStackTrace();

} }}

Called by the initiator – or could be called from run()

Dispatch the agent – note it calls a specific method on arrival

(27)

Several Other Toolkits

Gossip - Tryllian

Grasshopper – IKV++ Technologies

D’Agents - Dartmouth University

Voyager - ObjectSpace

MOA - Mobile Objects and Agents - The Open Group

Research Institute

Concordia - Mitsubishi Electric Lab

(28)

Mobile Agent Applications

WWW Information Retrieval

Electronic Marketplace

Distributed Data Mining

Mobile Computing

Space Presence

References

Related documents