Nomadic Pict: Getting Started

The example we are going to use is very simple. This program, ping_pong.pi, simply migrates a agent from one host to the other host, and prints out "ping" and "pong" in different machines. The communication we used is location-dependant.

The source code is listed below.

val pingBase = (sys.get_site 0)
val pongBase = (sys.get_site 1)

agent Pong =
new ack: ^[]

agent Ping =
migrate to pongBase

| <Pong@pingBase>ack![]

ack?[]= print!"Pong!"

 To run this program, you have to write the configuration file. The default name of it is "config". The content of the file is:

"dishwasher" 5000

"eggbeater" 5000

Now we will run it step by step.

  1. start a new npict virtual machine at eggbeater by typing "np -tport 5000"
  2. Run the Example code at dishwasher by typing "np ping_pong.pi -tport 5000"
  3. You should see the messages "Ping" and "Pong" at different site.