Java Mobile Agents to Delegate Work That They Could Have Done, to the Agent Software
Total Page:16
File Type:pdf, Size:1020Kb
What’s an Agent? The AI-based Definition An agent is software that assists people and acts on their behalf. Agents work by allowing people Java Mobile Agents to delegate work that they could have done, to the agent software. Danny B. Lange ü Autonomous ü Social Director, Agent Technology ü Goal-driven üAdaptive ü Reactive ü Mobile General Magic, Inc. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. What’s an Agent? Objective and Agenda The “Object” Definition What are mobile agents? An agent is an object with its private thread of What are they good for? execution, a.k.a. an active object. How do I get started? –Definitions ü Thread-based programming (autonomous) –Seven Good Reasons ü Conditional statements (goal-driven) –Applications ü Objects with methods (reactive) –Java ü Object interaction (social) –Getting Started with Aglets ü Exception handling (adaptive) –Future ü Serializable and Persistent (mobile) myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. What’s a Mobile Agent? – Not bound to the host where it begins DEFINITIONS execution. – Unique ability to transport itself from one host in a network to another. A mobile agent moves to a host that contains an object with which the agent wants to interact, then takes advantage of being in the same host as the object. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 1 Agent is Travelling from Mobile Agent Computer to Computer Computer Agent Agent Computer Principals Interface Network Implementation Agent State Identifier Computer myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Place • Engine: Workhorse and virtual machine for MOBILE AGENT MODEL one or more places • Resources: Databases, processors, and other services provided by the host • Location: The network address of a given place • Principals: Those legally responsible for the operation of a place myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Mobile Agent Place • State: needed for the agent to resume computation after travelling Host • Implementation: needed for location- independent agent execution Agents • Interface: needed for agent communication • Identifier: needed to recognize and locate Place Resources traveling agents • Principals: needed to determine legal and Engine moral responsibility myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 2 Seven Good Reasons for Using Mobile Agents - #3 • They encapsulate protocols SEVEN GOOD REASONS > As protocols evolve to accommodate new efficiency or security requirements, it is a cumbersome if not impossible task to upgrade protocol code properly. > Mobile agents are able to move to remote hosts in order to establish "channels" based on proprietary protocols. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Seven Good Reasons for Using Seven Good Reasons for Using Mobile Agents - #1 Mobile Agents - #4 • They reduce the network load • They execute asynchronously and autonomously App Service App Service Send agent RPC-based Host A Host B App Service Disconnect App Service Mobile Agent-based App Service approach Reconnect and return myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Seven Good Reasons for Using Seven Good Reasons for Using Mobile Agents - #2 Mobile Agents - #5 • They overcome network latency • They adapt dynamically > Critical real-time systems such as robots in > Mobile agents have the ability to sense their manufacturing processes need to respond to execution environment and react autonomously changes in their environments in real time. to changes. > Mobile agents offer a solution, since they can > Multiple mobile agents possess the unique be dispatched from a central controller to act ability to distribute themselves among the hosts locally and directly execute the controller's in the network in such a way as to maintain the directions. optimal configuration for solving a particular problem. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 3 Seven Good Reasons for Using So What About Mobile Agents - #6 Mobile Agent Applications? • They are naturally heterogeneous > Network computing is fundamentally • There are no “Mobile Agent Applications” heterogeneous, often from both hardware and software perspectives. > As mobile agents are generally computer- and • But there are plenty of applications that highly transport-layer-independent, and dependent benefit from using mobile agents only on their execution environment, they provide optimal conditions for seamless system integration. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Seven Good Reasons for Using Applications... Mobile Agents - #7 • They are robust and fault-tolerant • Telecommunication networks services > The ability of mobile agents to react > Support and management of advanced dynamically to unfavorable situations and telecommunication services are characterized events makes it easier to build robust and fault- by dynamic network reconfiguration. tolerant distributed systems. > The physical size of these networks and the > If a host is being shut down, all agents strict requirements under which they operate executing on that machine will be warned and call for mobile agent technology to form the given time to dispatch and continue their "glue" that keeps such systems flexible yet operation on another host in the network. effective. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Applications... • Personal assistance. APPLICATIONS > The mobile agent's ability to execute on remote hosts makes it suitable as a "assistant" capable of performing tasks in the network on behalf of its creator. > The remote assistant will operate independently of its limited network connectivity, and the creator can feel free to turn his or her computer off. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 4 Applications... The Impact of Java • Workflow applications and groupware • Secure execution • Electronic Commerce > Java has a pointer model that eliminates the • Secure Brokering possibility of overwriting memory and • Distributed information retrieval corrupting data. • Monitoring and notification > The security architecture of Java makes it reasonably safe to host an untrusted agent, • Information dissemination because it cannot tamper with the host or access • Parallel processing private information. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. The Impact of Java • Dynamic class loading JAVA > Allows the virtual machine to load and define classes at runtime. • Multithread programming > Agents are by definition autonomous. > Java not only allows multithread programming, but also supports a set of synchronization primitives that are built into the language. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. The Impact of Java The Impact of Java • Platform-independence • Object serialization > Java is designed to operate in heterogeneous > A key feature of mobile agents is that they can networks. be serialized and deserialized. > Primitive data types are rigorously specified > Java conveniently provides a built-in and not dependent on the underlying processor serialization mechanism that can represent the or operating system. state of an object in a serialized form > It allows us to create a mobile agent without sufficiently detailed for the object to be knowing the types of computers it is going to reconstructed later. run on. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 5 Significant Shortcomings The Aglet Package • Inadequate support for resource control • The aglet API is simple and flexible. > Unfortunately, Java provides no ways for the • Created in the spirit of Java and representing a host to limit the processor and memory lightweight pragmatic approach to mobile agents, the resources allocated by a given object or thread. aglet API is a Java package consisting of classes and Enables denial of service attacks. interfaces, most notably: > A related issue is the ability of the agent to • Aglet allocate resources external to the program, for • AgletProxy example by opening files and sockets, and • AgletContext creating windows. • Message • FutureReply • AgletID myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. Significant Shortcomings Aglet Class • No support for preservation and • The abstract class that you use as base class when you resumption of the execution state create your customized aglets. • Defines methods for controlling its own life cycle, > It is currently impossible in Java to retrieve the namely, methods for cloning, dispatching, full execution state of an object. deactivating, and disposing of itself. > Information such as the status of the program • It also defines methods that are supposed to be counter and frame stack is permanently overridden in its subclasses by the aglet programmer, forbidden territory for Java programs. and provides you with the necessary "hooks" to customize the behavior of the aglet. myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. My First Aglet IBM’S AGLETS SOFTWARE DEVELOPMENT KIT (ASDK) import aglet.*; public class MyFirstAglet extends Aglet { // Put aglet's methods here } myTalk.com ©1998 General Magic, Inc. myTalk.com ©1998 General Magic, Inc. 6 Collaboration Diagram My First Aglet for Dispatch • Initialization run() public void