Guided tour

This is an introduction to the functionalities offered by ProActive : you will be performing distributed computations, moving objects between virtual machines and verify the transparency of the

1. Installation

Follow the instructions for downloading and installing ProActive.

The examples used in this tour are provided in the /scripts directory of the distribution.

The scripts are platform dependant : .sh files on linux are equivalent to the .bat files on windows

2. The Reader-Writer example

Illustrates several synchronization policies.

2.1 start the Reader-Writer application

Use the readers script

2.2 look and check the effects of the different policies : even, writer priority, reader priority

What happens when priority is set to "reader priority" ?

2.3 look at the code for programming such policies

in org.objectweb.proactive.examples.readers.ReaderWriter.java

More specifically, look at the routines in :

public void evenPolicy(org.objectweb.proactive.Service service)

public void readerPolicy(org.objectweb.proactive.Service service)

public void writerPolicy(org.objectweb.proactive.Service service)

Look at the inner class MyRequestFilterm that implements org.objectweb.proactive.core.body.request.RequestFilter

How does it work?

2.4 Introduce a bug in the Writer Priority policy

For instance, let several writers go through at the same time.

- observe the Writer Policy policy before recompiling

- recompile (using compile.sh readers or compile.bat readers)

- observe that stub classes are regenerated and recompiled

- observe the difference due to the new synchronization policy : what happens now?

- correct the bug and recompile again ; check that everything is back to normal

3. The dining philosophers

The "dining philosophers" problem is a classical exercise in the teaching of concurrent programming. The goal is to avoid deadlocks.

We have provided an illustration of the solution using ProActive, where all the philosophers are active objects, as well as the table and the dinner frame (user interface).

3.1 start the philosophers application

with philosophers.sh or philosophers.bat

3.2 understand the color codes

Philosophers
philosophing
hungry, wants the fork !
eating
Forks
taken
free

 

 

3.3 test the autopilot mode

The application runs by itself without encountering a deadlock.

3.4 test the manual mode

Click on the philosophers' heads to switch their modes

Test that there are no deadlocks!

Test that you can starve one of the philosophers (ie the others alternate eating and thinking while one never eats!)

3.5 start the IC2D application

IC2D is a graphical environment for monitoring and steering of distributed and metacomputing applications.

- being in the autopilot mode, start the IC2D visualization application (using ic2d.sh or ic2d.bat)

- acquire you current machine

menu monitoring - monitor new RMI host

look at the active objects, and at the topology

4. C3D : a parallel, distributed and collaborative 3D renderer

C3D is a Java benchmark application that measures the performance of a 3D raytracer renderer distributed over several Java virtual machines using Java RMI.

4.1 start C3D

using the script c3d_no_user

A "Dispatcher" object is launched (ie a centralized server) as well as 4 "Renderer" objects, that are active objects to be used for parallel rendering.

The bottom part of the window allows the addition and removal of renderers.

4.2 start a user

using c3d_add_user

- connect on the current host (proposed by default) by just giving your name

- spin the scene, add a random sphere, and observe how the action takes place immediately

- add and remove renderers, and observe the effect on the "speed up" indication from the user window.

Which configuration is the fastest for the rendering?

Are you on a multi-processor machine?

4.3 start a user from another machine

using the c3d_add_user script, and specifying the host (NOT set by default)

If you use rlogin, make sure the DISPLAY is properly set.

You must use the same version of ProActive on both machines!

- test the collaborative behavior of the application when several users are connected.

Notice that a collaborative consensus must be reached before starting some actions (or that a timeout occured).

4.4 start IC2D to visualize the topology

- to visualize all Active objects, you need to acquire ("monitoring" menu) :

- the machine on which you started the "Dispatcher"

- the machine on which you started the second user

- add random spheres for instance, and observe messages (Requests) between Active Objects.

- add and remove renderers, and check graphically whether the corresponding Active Objects are contacted or not, in order to achieve the rendering.

- you can textually visualize this information activating "add event timeline for this WorldObject" on the World panelm with the right button, and then "show the event list window" on the top menu window

4.5 drag-and-drop migration

- from IC2D, you can drag-and-drop active objects from one JVM to another. Click the right button on a C3DRenderingEngine, and drag and drop it in another JVM. Observe the migration taking place.

- add a new sphere, using all rendering engines, and check that the messages are still sent to the active object that was asked to migrate.

- as migration and communications are implemented in a fully compatible manner, you can even migrate with IC2D an active object while it is communicating (for instance when a rendering action is in progress). Give it a try!

4.6 start a new JVM in a computation

manually you can start a new JVM - a "Node" in the ProActive terminology - that will be used in a running system.

- on a different machine, or by remote login on another host, start another Node, named for instance NodeZ :

under linux : startNode.sh rmi://mymachine/NodeZ & (or startNode.bat rmi://mymachine/NodeZ)

The node should appear in IC2D when you request the monitoring of the new machine involved (Monitoring menu, then "monitor new RMI host".

- the node just started has no active object running in it. Drag and drop on of the renderers, and check that the node is now taking place in the computation :

- spin the scene to trigger a new rendering

- see the topology

* if you feel uncomfortable with the automatic layout, switch to manual using the "manual layout" option (right click on the World panel). You can then reorganize the layout of the machines.

- to fully distribute the computation, start several nodes (you need 2 more) and drag-and drop renderers in them.

Depending on the machines you have, the complexity of the image, look for the most efficient configuration.

4.7 have a look at the source code for the main classes of this application :

org.objectweb.proactive.examples.c3d.C3DUser.java

org.objectweb.proactive.examples.c3d.C3DRenderingEngine.java

org.objectweb.proactive.examples.c3d.C3DDispatcher.java

look at the method public void processRotate(org.objectweb.proactive.Body body, String methodName, Request r) that handles election of the next action to undertake.

5. Mobile agents

This example shows a set of mobile agents moving around while still communicating with their base and with each other. It also features the capability to move a swing window between screens while moving an agent from one JVM to the other.

5.1 start the penguin application

using the penguin script.

5.2 start IC2D to see what is going on

using the ic2d script

acquire the machines you have started nodes on

5.3 add an agent

- on the Advanced Penguin Controller window : button "add agent"

- select it, and press button "start"

- observe that the active object is moving between the machines, and that the penguin window disappears and reappears on the screen associated with the new JVM.

5.4 add several agents

after selecting them, use the buttons to :

- communicate with them ("call agent")

- start, stop, resume them

- trigger a communication between them ("call another agent")

5.5 move the control window to another user

- start a node on a different computer, using another screen and keyboard

- monitor the corresponding JVM with IC2D

- drag-and-drop the active object "AdvancedPenguinController" with IC2D into the newly created JVM : the control window will appear on the other computer and its user can now control the penguins application.

- still with IC2D, doing a drag-and-drop back to the original JVM, you will be able to get back the window, and control yourself the application.

6. develop you own application

pick up your favorite topic, and develop your own distributed application using the ProActive library. Don't forget to use IC2D to visualize the topology, and to debug.

7. other applications

you can also try other applications