Академический Документы
Профессиональный Документы
Культура Документы
Abstract: In recent years, Grid computing has emerged as a promising alternative to increase the capacity of
processing and storage, through integration and sharing of multi-institutional resources. In order to overcome
some of its construction challenges, the Grid must be able to move computations among its nodes. Process
migration offers several advantages in the context of a Grid middleware, such as load sharing, communication
performance, availability, reconfiguration and usage of special capabilities. In this paper, we will describe a
transparent migration mechanism in the context of MAG, a mobile agent based Grid middleware. Given that
MAG was developed with Java, we will be detail some problems and solutions associated with the migration of
Java threads, and will show our transparent migration framework implementation.
Key-Words: distributed computing, Grid computing, mobile agents, agent systems, migration, transparent
mobility
1
Fig. 1: Layers architecture of the MAG / Integrade Foundation for Intelligent Physical Agents - non-
Grid middleware profit organization aimed at producing standards for
the interoperation of heterogeneous software agents.
Available in: http://www.fipa.org/
on shipped state. However, to migrate a process, is provide sufficient mechanisms for capturing the
necessary to know what exactly comprises the computation state. The Java serialization
process and its state. mechanism only allows the saving of code and
Fuggetta, in 1998, has defined that a process values of object members. Java classes cannot
consists of three basic segments: the code segment, access intern and native information of the Java
the resource segment and the execution Virtual Machine (e.g. program counter, call stack,
segment[8]. Code segment is the part that contains etc.), necessary to save the full execution state[12]
the set of instructions that make up the program of a Java thread.
that is being executed. The resource segment During the last years, several techniques were
contains references to external resources needed by developed that artificially gathers the information
the process, such as files, printers, devices, other required to fully capture the state of Java threads.
processes, and so on. Finally, an execution segment They can be classified in four basic approaches
is used to store the current execution state of a [12, 4, 13, 9]:
process, consisting of private data, the stack, and Modification of the Virtual Machine: the virtual
the program counter. machine is modified to export execution
A migration mechanism that migrates these information. The major disadvantage of this
three segments, and restart a process in exactly the approach is the lack of portability in respect to the
same state and at the same code position as it was standard VM. It is very difficult to maintain
before the migration, is called transparent or complete compatibility with the Sun Java
characterized as strong migration[9]. The strong specification;
migration provides to process the abstraction that
Instrumentation of the application source code:
the execution was not interrupted. Strong mobility
this technique consists in the use of a preprocessor
is very powerful, but much harder to implement.
(a source code compiler). This preprocessor inserts
In contrast, the non-transparent migration source code responsible for capturing and restoring
(known as weak migration) can be defined as every the execution state. The main problem with this
migration that is not strong[4]. In the weak technique is that the source code must be available,
migration only the code segment is transferred, and which is not always possible, such as the case
perhaps some initialization data. A characteristic when libraries are used. Another disadvantage with
feature of weak mobility is that a transferred this technique is the time and space overhead
program is always started from its initial state. caused by the insertion of code;
Strong mobility simplifies the task of the,
Instrumentation of the application bytecode: in
therefore it does not have to implement the
this approach, the code for capturing and restoring
migration process explicitly - the process state is
the execution state is inserted directly in the
saved automatically. This approach distinguishes
application bytecode. As well as the source code
from the weak, where the programmer has to
instrumentation approach, some time and space
create the code responsible for save and reestablish
overhead is generated by the insertion of code in
the complete state of the process.
the original code. However, the overhead is
generally lower than the source code approach.
3.1 Migration Transparency in Java Another advantage is that, in the bytecode level,
Java has been put forward as the preferred we have access to an extended set of instructions,
language for the developing of mobile agents such as the goto instruction;
platforms. This choice is explained by the fact that Modification of the Java Platform Debugger
agents must be able to run on heterogeneous Architecture: the Java Platform Debugger
platforms. Javas machine independent bytecode is Architecture (JPDA) is part of the virtual machine
responsible for this. Moreover, the ease of specification. Using JPDA, runtime information
transport over the net of Java bytecode, the Suns about applications can be accessed in debug mode.
serialization mechanism (that allows the migration This can be used to perform transparent migration.
of objects data) and the security concepts Since the JPDA does not provide all information
provided by the Java platform, are some of other necessary for transparent migration, it is necessary
features that makes Java a good choice for the some modifications in the JPDA core. Moreover,
developing of mobile applications. this approach does not allow the use of JIT
However, the use of Java introduces some compilation, raising the application execution time,
problems for process migration. Java does not
generating the much higher overhead of all MAG, given that several applications can be
approaches. running in each Grid node.
The Brakes has another version called Brakes-
4 Migration in MAG parallel, that allows the execution of concurrent
threads. This version was developed as a proof-of-
The design of the MAG process migration
concept system, without any optimizations for real-
mechanism took into consideration the benefits and
world use. It is an unoptimized add-on of the first
disadvantages of each approach for Java thread
prototype, and has a much higher overhead. This
migration described on Section3.1 in respect to
higher overhead is caused by a set of new
Grid middleware requirements. For example, Grid
components that was added to the serial version.
systems must transpose several administrative
domains. Imposing a standard JVM for several
4.1 MAG/Brakes
Institutions as required by the JVM modification
approach is not well suited for Grid systems. Grid The MAG/Brakes is a subset of the original
systems should be able to execute scientific Brakes. Given the limitations in Brakes, we
applications that are developed using shared decided to use, in MAG, only its bytecode
libraries, whose source code are not always transformer. Thus, the Brakes components (e.g. a
available. This limits the applicability of the source thread scheduler) were discarded in our
code instrumentation approach for Grid systems. A implementation.
good application execution performance is As was said in the previous section, the
essential in Grid systems, the major disadvantage Brakes-serial cannot be used in the MAG,
of the JPDA modification approach. because of the limitation of execute only one
Given the above considerations, we decided to thread per time. Thus, we had to use the Brakes-
implement the MAG migration mechanism based parallel as the basis of our implementation. Thus,
on the instrumentation of application bytecode. when we say Brakes, we are talking about the
The mechanism is based on a modified version of Brakes-parallel version.
the Brakes[18, 5] framework, developed at the We have changed the structure of Brakes to
Katholieke Universiteit Leuven, Belgium, by the obtain a better performance and to provide new
Distributed systems and computer Networks functionalities:
(DistriNet) research group.
The Brakes framework is composed by several
Brakes is a framework that provides a thread components used to store execution information
serialization mechanism for Java. It was developed and execution states, and to manage the application
at the Katholieke Universiteit Leuven, Belgium, by execution, e.g. start, suspend, resume, stop, etc.
the Distributed systems and computer Networks The use of these components was causing a large
(DistriNet) research group. It allows the capture overhead, because of the great number of accesses
and re-establishment of Java threads execution to these objects in the heap. We modified the
state through the bytecode instrumentation original transformer in order to store the state
approach. This feature is basic for the development information inside each object, as attribute
of many mechanisms in distributed systems like members, reducing the access cost to data
transparent migration, fault tolerance and object necessary for the migration process;
persistence.
As a new feature, the user can now explicitly
Currently, Brakes consists of two parts:
inform to the bytecode transformer, a code position
A ByteCode transformer (based on version 1.4 of where he wants that the application state have to be
the ByteCode Engineering Library[6]) which saved. This is done by the user through a
instruments Java class-files, so they are able to doCheckpoint() method invocation;
capture their current internal state at any given
Brakes insert code to save the application state
time;
after each method invocation. Now, the user can
A small framework which uses the ability of the inform to the transformer that ONLY the
patched classes to allow Java threads to pause invocations to the doCheckpoint method have to
and resume whenever desirable. save the applications state, ignoring the other
The standard version of the Brakes framework is invocations.
called Brakes-serial. This version does not allow
the concurrent execution of threads. This feature
becomes this version inadequate for use in the
4.1.1 MAG/Brakes Implementation if (this.lastStackInContext()) {
// i am not capturing and
In the MAG/Brakes implementation, each task
// reestablishing my state
being executed in a Grid node has some boolean
switching = false;
flags associated with it. This flags represents three
restoring = false;
different modes of execution:
}
Running: the task is executing normally; // get LPI from context
Switching: the task is in the process of capturing its switch (this.myContext.popInt()) {
current execution state into its context; case 0:
// restore the stack frame
Restoring: the task is in the process of i = this.myContext.popInt();
reestablishing its previous execution state from its this = (Fibonacci)
context; this.myContext.popThis();
These flags and the context of the thread are this.myContext.popObject();
members of a class called MagApplication, which // go to the correct instruction
must be inherited by all MAG applications. goto _L5;
After the compilation, the MAG/Brakes }
transformer inserts code into the application } (...) } (...)
bytecode. The bytecode transformer inserts a state //--------------------------------------
capturing block after every method invocation. The
code tests if the flag switching is set. In the Fig. 3: State reestablishment
positive case, the capture of context is done. This
code can be seen in the fig. 2. When an agent wants to capture the state of a
For each method invocation, we save the thread, it invokes (in the thread object) the method
corresponding stack frame (the method local doYield(). The method doYield() sets the
variables and the operand stack). An artificial switching flag to true. The modification of this flag
program counter is also stored in the tasks context. causes the capturing of the thread state, done by
This is a cardinal index that refers to LPI-index the code inserted by the MAG/Brakes transformer.
(each invocation has a unique LPI-index
associated). The MAG/Brakes also provides the
complementary operation: the reestablishment of
//-------------------------------------- execution state. The transformer inserts additional
int m; code in the beginning of each invoked method
(...) body. This inserted code consists of several state
fibonacci (m); // <- method invocation reestablishing code blocks, one for each code
if(this.isSwitching()) { position where the previous execution of the
// store stack frame into method may have been suspended. This code block
// myContext attribute is shown in the fig. 3.
this.myContext.pushThis(this);
this.myContext.pushObject(this); In order to resume the execution of an
application, the agent invokes the method
// store artificial program counter doResume() that sets the restoring flag to true. The
// as LPI-index computation is then restored and continued
this.myContext.pushInt(0); transparently.
return;
In the actual MAG/Brakes implementation, the
} (...)
resource segment is not migrated. The external
//--------------------------------------
environment of application is not taken into
Fig. 2: State capturing consideration and the connections to devices, like
printers, files and others, are not migrated in a
//-------------------------------------- transparent way. Only the migration of single-
public int fibonacci (int i) { threaded applications can be done.
if(this.isRestoring()) {
// if this is the last stack
// frame in the context
5 Performance Evaluation execution of a recursive fibonacci application. We
have chosen this algorithm because of the great
Instrumenting and inserting code introduces time number of invocations that it performs. Thus, we
and space overhead. Since code is inserted for each can consider the recursive fibonacci as our worst
method invocation, the space overhead is directly case analysis.
proportional to the number of invocations that
All tests were performed on a Sempron 2200+
occur in the code[18]. We performed several tests
over-clocked to 1.8 GHz, 256 MB of RAM,
to measure the overhead imposed by our
running Linux (kernel 2.6.10). We measured two
implementation in comparison to the normal
aspects:
1. The time execution overhead incurred by the We also compared the file size penalty caused by
checkpoint mechanism in comparison with the each mechanism. Table 1 shows the values (in KB) of
normal (non-instrumented) execution, the Brakes- class files generated by each approach.
serial, and Brakes-parallel;
2. The class file space overhead, in comparison Mechanism File size Overhead
to the non-instrumented one. Normal 1.3 -
Brakes-serial 1.7 30,77 %
Fig. 4 show a graph that compares the execution MAG/Brakes 1.9 46,15 %
times for the same application (Fibonacci) given an
Brakes-parallel 1.7 30,77 %
input of 20, 25, 30, and 35. We can notice that the
time overhead caused by MAG/Brakes is only
Table 1: Comparison of space overhead caused by
marginally higher than Brakes-serial. The difference
each mechanism
is due the fact that Brakes-serial uses static
invocations, which are faster than conventional
Based on the tests performed, our conclusion is
invocations to objects. However, this limits Brakes-
that the time and space overhead caused by the
serial to manipulate only a single (static) reference to
MAG/Brakes, despite of being a little higher than the
the thread being executed.
one caused by Brakes-serial, is justified by the
advantage of being able to execute threads
concurrently. This feature is extremely important in [3] S. Bouchenak, D. Hagimont, S. Krakowiak,
the context of the MAG Grid infrastructure. and N. D. Palma. Experiences
implementing efficient java thread
6 Related Work serialization, mobility and persistence. In
There are many systems that provide mechanisms for Software - Practice and Experience,
capture and reestablish the execution state of Java volume 34, pages 355394, 2004.
threads. In the following, we cite some projects, [4] A. J. Chakravarti, X. Wang, J. O.
associating them with the implementation approach Hallstrom, and G. Baumgartner.
adopted. Implementation of strong mobility for
WASP[9] and JavaGo[16] support the capture of multi-threaded agents in java. In 2003
execution state through source code instrumentation. International Conference on Parallel
In the Grid, many times it will be necessary to Processing (ICPP 03). IEEE Computer
execute applications where the source code are not
Society Press., pages 321330, Koahsiung,
available, making this alternative inappropriate.
JavaThread[3], DAgents[11], Sumatra[1],
Taiwan, 6-9 October 2003.
Merpati[17] and ARA[15] depend on extensions of [5] T. Coninx, E. Truyen, W. Joosen, and
the standard VM from Sun. This approach is also not P. Verbaeten. On the use of threads in
attractive for Grid systems considering the great mobile object systems. ECOOP2000
heterogeneity of Grid environments. The CIA[13] Workshop on Mobile Object Systems, 2000.
project uses the JPDA API (Java Platform Debugger
[6] M. Dahm. Byte code engineering with the
Architecture) leading to great overhead in execution
time, caused by the absence of JIT (Just-in-Time) bcel api. Technical report, Freie University
compilation. Berlin, 2001.
[7] F. Douglis and J. K. Ousterhout.
7 Conclusions and Future Work Transparent process migration: Design
alternatives and the sprite implementation.
In this paper, we described a strong migration
mechanism in the context of MAG, a mobile agent Software - Practice and Experience,
based Grid middleware. We have detailed the 21(8):757785, 1991.
requirements involved with the construction of this [8] A. Fuggetta, G. P. Picco, and G. Vigna.
mechanism and the problems associated with the Understanding Code Mobility. IEEE
capture and reestablishment of Java threads state. We Transactions on Software Engineering,
have also presented the MAG/Brakes, a framework 24(5):342361, 1998.
based on Brakes that provides the strong migration
feature in MAG. [9] S. Funfrocken. Transparent Migration of
Java-Based Mobile Agents: Capturing and
In the nearby future, we intend to overcome the
limitations of the actual MAG/Brakes version,
Reestablishing the State of Java Programs.
providing the migration of multi-threaded In Proc. of the Second International
applications and the migration of the resources Workshop on Mobile Agents, pages 2637,
(printers, files, etc.) associated with the threads. Stuttgart, Germany, September 1998.
[10] A. Goldchleger, F. Kon, A. Goldman,
References M. Finger, and G. C. Bezerra. Integrade:
[1] A. Acharya, M. Ranganathan, and J. Saltz. Object-oriented Grid middleware
Sumatra: A Language for Resource-aware leveraging idle computing power of
Mobile Programs. In Mobile Object desktop machines. Concurrency and
Systems: Towards the Programmable Computation: Practice & Experience. Vol.
Internet, volume 1222, pages 111130. 16, pp. 449-459, 2004.
Springer-Verlag: Heidelberg, Germany, [11] R. S. Gray, G. Cybenko, D. Kotz, R. A.
1997. Peterson, and D. Rus. Dagents:
[2] Y. Artsy and R. A. Finkel. Designing a Applications and performance of a mobile-
process migration facility: The charlotte agent system. In Software - Practice and
experience. IEEE Computer, 22(9):4756, Experience, number 32(6), May 2002.
1989.
[12] T. Illmann, F. Kargl, T. Krueger, and
M. Weber. Migration in Java: problems,
classifications and solutions. In
MAMA2000, Wollongong, Australia,
2000.
[13] T. Illmann, T. Krueger, F. Kargl, and
M. Weber. Transparent migration of mobile
agents using the Java Platform Debugger
Architecture. In Lecture Notes in Computer
Science, volume 2240, page 198, Jan 2001.
[14] E. Jul, H. Levy, N. Hutchinson, and
A. Black. Fine-Grained Mobility in the
Emerald System. ACM Transactions on
Computer Systems, 6(1):109133, February
1988.
[15] H. Peine and T. Stolpmann. The
architecture of the Ara platform for mobile
agents. In R. Popescu-Zeletin and
K. Rothermel, editors, First International
Workshop on Mobile Agents MA97,
volume 1219 of Lecture Notes in Computer
Science, pages 5061, Berlin, Germany,
Apr. 1997. Springer Verlag.
[16] T. Sekiguchi, H. Masuhara, and
A. Yonezawa. A Simple Extension of Java
Language for Controllable Transparent
Migration and Its Portable Implementation.
In Coordination Models and Languages,
pages 211226, 1999.
[17] T. Suezawa. Persistent execution state of a
java virtual machine. In Proc. of the ACM
2000 conference on Java Grande, 2000.
[18] E. Truyen, B. Robben, B. Vanhaute,
T. Coninx, W. Joosen, and P. Verbaeten.
Portable support for transparent thread
migration in java. In ASA/MA, 2000.