Persisting Autonomous Workflow for Mobile Agents Using a Mobile Thread Programming Model



Download 299.16 Kb.
Page2/3
Date28.05.2018
Size299.16 Kb.
#50866
1   2   3

3.2 Proof of MTPM's correctness


Generally, objects that are generated by an agent are in Zone A, Zone B or Zone C. Objects in Zone A can be persisted by Java Serialization because they are class-level variables. However, objects in Zone B or Zone C can not be persisted by Java Serialization because local variables of a method are located in the method call stack of JVM and can not be reached by Java Serialization. But according to Object-oriented paradigm, any object that is generated in a method is local and transient, so any persistent information of an agent does not depend on objects in Zone B or Zone C. In addition, any object in Zone B, which may be used in following case branches, is regenerated when the method run() is recalled; Objects in Zone C do not depend on each other if they are in different case branches. Summarizing the above features in the proposed paradigm of agent design, we have the following theorem, which proves that the persistence of agent thread can be simulated by MTPM.

Axiom 1: For any object Obj, Obj is equal to Deser(Ser(Obj)).

Axiom 2: The execution state of an agent's thread is only determined by both the states of the agent's objects in Zone A and the execution point of the method run() in MTPM paradigm.

Theorem 1: The persistence of an agent thread can be simulated by MTPM during the agent migration.

Proof: We must define entry_point as a member variable of a mobile agent class because Serialization can not capture any local variable of a method. Suppose an agent executes a mobile primitive AgentMobileTo(Destination, k), which is the number k-1 statement of the agent's method run(), then the execution stop-point k is stored in the object entry_point of the agent. Also suppose the agent has valid objects Obj1, Obj2,……, Objn (of course including the object entry_point) in Zone A, then the method onDispatch() of the agent will serialize all the objects, i.e. performs Ser(Obj1), Ser(Obj2),……, Ser(Objn) when the method is called just after AgentMobileTo. When the agent object is transported to the destination, its method onArrival() is called. The method onArrival() deserializes all the serialized objects, i.e. performs Deser(Ser(Obj1)), Deser(Ser(Obj2)),……, Deser(Ser(Objn)). From Axiom 1, Obji is equal to Deser(Ser(Obji), where i belongs to {1, 2,……n}, so states of all the objects in Zone A of the agent (of course including object entry_point) are persistent. …..…(a)

When the agent is restarted at the destination, its thread's execution method, run(), is called. All the objects in Zone B will be regenerated and the method run() will execute from the case statement that is determined by object entry_point. Because the object entry_piont is k, the stopped execution point is restored from the statement k after the agent migration has been completed. ………………………(b)

From (a) and (b), the execution state of the agent's thread is persistent after the agent migration according to Axiom 2.

4 Foundation of MTPM Implementation


Our agents need persistence, which is the ability of an object to record its execution state so the state can be reproduced in other environments. With the release of Java1.1, the Java community has gained access to a wide variety of features. Important features, which contribute to the implementation of MTPM, are object Serialization and RMI. Combinations of these make it possible to simulate persistence of an agent's thread with object persistence.

Object Serialization provides a program with the ability to read or write a whole object to and from a raw byte stream. It allows objects and primitives to be encoded into a byte stream suitable for streaming to some type of network or to a file-system, or more generally, to a transmission medium or storage facility. The real power of object Serialization is the ability of programs to easily read and write entire objects and primitive data types, without converting to/from raw bytes or parsing clumsy text data. Object Serialization has taken a step in the direction of being able to store objects instead of reading and writing their state in some foreign and possibly unfriendly format. In order to be persistent, the class definition of a mobile agent should implement the Serializable interface. We can customize serialization for an agent by rewriting and providing two methods writeObject and readObject to the agent. The two methods in agent implementation are functional equivalents to onDispatch() and onArrival() in MTPM. The process of serializing an object involves traversing the graph created by each object's references to other objects and primitives. So all the objects including agent object and objects that can be reachable by references of the agent are preserved during agent Serialization.



RMI enables a program running on a client computer to make method calls on an object located on a remote server machine. Object-oriented design requires that every task be executed by the object most appropriate to that task. RMI takes this concept one step further by allowing a task to be performed on the machine most appropriate to the task. A client can invoke the methods of a remote object with the same syntax that it uses to invoke methods on a local object. RMI has several advantages over traditional Remote Procedure Call (PRC). RMI can pass full objects as arguments and return values. This means that we can pass complex types such as an agent object as a single argument without extra converting codes. Passing objects lets us use full power of object-oriented technology in agent migration. When passing an object as an argument, RMI moves class implementations of the object at the same time. At this point, RMI moves behavior from a client to a server or a server to a client, so we can benefit from fully object-oriented patterns for agent design. In addition, RMI uses built-in Java security mechanisms that allow the agent system to be safe when moving agents. Customized security mechanisms are easily integrated into agent system with RMI security Model such as specifying Security Manager in Java 1.1 or Policy File in Java 1.2. With RMI we can write a mobile agent system in the simplest form like this:



In an agent system, an Agent Server is a remote object to which other Agent Servers in the system have references. Transporting an agent would be a matter of creating a class that implemented the Agent interface, finding a server, and invoking its TransferIn method with the agent object as an argument. The implementation for the agent would be transported to the server and run there. We don not have to write the two methods of onDispatch() and onArrival() if we would like to perform default serialization for a mobile agent by RMI. After deserializing the agent, the TransferIn() method will start up a new thread for the agent and invoke its run() method.



Download 299.16 Kb.

Share with your friends:
1   2   3




The database is protected by copyright ©ininet.org 2024
send message

    Main page