Hi, All --

JaCOb is Maciej's invention, so I'm hoping that he'll jump in here at some point and add a layer of detail.

The articles that Matt pointed to can make some interesting reading (I like the Sangiori and Weaver book (ISBN 0521781779) and Gul Agha's thesis (linked from my bookmarks -- http://del.icio.us/prb/actors)). **BUT** PXE is a *PRACTICAL* design, you don't need any of the heavy machinery to appreciate how PXE works.

Getting back to the sieve example with JaCOb, here's the basic idea:

The Sieve of Erasthones (http://en.wikipedia.org/wiki/ Sieve_of_Eratosthenes) provides a way to enumerate prime numbers. In terms of the example, you have three process terms that work together:

1) You've got a counter term that sends integers one after the other.
2) You've got a head term that works like a factory for primality checkers.
3) You've got a printer.

We start off with an arrangement like this:

Counter -1-> Head -2-> Print

Counter sends 2 to Head on -1->, and Head creates a prime checker and a new Head. The new Head still talks to Print on -2->. The prime checker listens on -1-> and checks for relatively primeness to 2; if it succeeds, it tells the new Head (on -3->). So we have:

Counter -1-> P2 -3-> Head -2-> Print

Note that the P2 above is really the term PrimeFilter(2,-1->,-3->), Head is really Head(-3->,-2->), and Counter is really Counter(3,-1->).

When Counter sends 3, P2 passes it along, and Head again spawns a checker for relatively primeness to 3 and a new Head:

Counter -1-> P2 -3-> P3 -4-> Head -2-> Print

Counter is really Counter(4,-1->), and this time, PrimeFilter(2,-1- >,-3->) just absorbs it. Counter is now Counter(5,-1->), 5 will flow from P2 to P3 to Head, which spawns a mod 5 checker and a new Head, etc.

This is what the Sieve example does, and JaCOb ("[Ja]va [C]oncurrent [Ob]jects") is a relatively thin layer to translate between notation like the above and Java. The translation between process notation like the above and JaCOb notation takes a little getting used to, but this little snippet is relatively close to the underlying notation:

  Process:
    ( v x )
  JaCOb:
NaturalNumberStreamChannel x = newChannel (NaturalNumberStreamChannel.class);

  Process:
    PrimeFilter(n,_in,x)
  JaCOb:
    instance(new PrimeFilter(n, _in, x));

  Process:
    Head(x,_primes)
  JaCOb:
    instance(new Head(x, _primes));

And this is the "spawning" phenomenon within a Head(...) term. (Parallelism is implicit in JaCOb, so no "|" is needed.) This is covered in the JavaDoc for the instance method on Abstraction -- "instance(new Term(args))" in JaCOb Java notation is equivalent to "Term(args)" in process notation. In the same vein, "self" is a reduction of the represented term.

Does this make some sense so far?

        -- Paul


On Apr 6, 2006, at 3:15 PM, Alex Boisvert wrote:


Yes, the sieve example can be found at:

$PXE_SVN/jacob/src/java/com/fs/jacob/examples/eratosthenes/Sieve.java

alex


Paul R Brown wrote:


Hi, Bill --

We are trying to understand the PXE contribution.  Is this the
implementation basis for PXE?
http://www.labri.fr/perso/grange/documents/fmppta.pdf


Funny -- that's a *different* Jacob but with a few ideas in common.
(Or at least that's the way it looks after I skimmed the paper.)

Did the prime sieve example make it into the submission?  If so, I
can walk through that as an explanation.

Best,

-- Paul



Reply via email to