From: Antonio Menezes Leitao
Subject: Linj needs testing on multiprocessor machines
Date: 
Message-ID: <87acxxb4ty.fsf@evaluator.pt>
Hi,

I've just implemented the concept of futures in Linj.  A future
represents the result of a computation that is being done in parallel
with other computations.  Each computation is done by a process.  When
a process needs the value of a future and the computation of the
future didn't finish yet, the requesting process blocks and waits
until the value becomes available.

The implementation of futures in Linj is strongly influenced by the
Qlisp model.  In particular, the following example of a parallel
factorial using the qlet parallelizing form runs without modification
in Linj:

(defun pfact (n depth)
  (prod 1 n depth))

(defun prod (m n depth)
  (if (= m n)
    m
    (let ((h (floor (+ m n) 2)))
      (qlet (> depth 0)
	    ((x (prod m h (- depth 1)))
	     (y (prod (+ h 1) n (- depth 1))))
	(* x y)))))

The idea is that the qlet form evaluates its first argument and, if
true, starts parallel processes to compute the variable bindings and
proceeds with the evaluation of the body.  If the evaluation of the
first argument is false, the qlet form becomes exactly the same as the
let form.

Obviously, a parallel factorial is only useful if the time spend
creating and schedulling threads is balanced by the inherent
parallelism available in the hardware.  It is precisely this balance
that I would like to test by trying to compute factorials with
different values of depth (implying a different number of processes).

Unfortunately, I don't have such hardware available so I would like to
ask readers of comp.lang.lisp that have such hardware available and
that are willing to give away some CPU cycles to test a few examples
that I will provide.  For the testing to be useful, we will need a
genuine multiprocessor machine (the larger number of processors, the
better) with a Java implementation that uses native threads (e.g., the
Hotspot VM).  Note that green threads do not take advantage of
multiprocessors.

If you would like to help, send me an email and I'll send you a few
short Java programs that you can inspect, run, collect the results and
send them to me.

Thanks in advance,

Ant�nio Leit�o.