[concurrency-interest] FJ usage question: Mutable procedures

Doug Lea dl at cs.oswego.edu
Tue Aug 26 08:59:59 EDT 2008


David J. Biesack wrote:
> ParallelDoubleArray has a summary() method; but it's not implemented in
> terms of the public apply/Ops.DoubleProcedure API of
> ParallelDoubleArray. I'd like to make that more general and define a
> Ops.DoubleProcedure to compute extended summary statistics, or perform
> other operations which require updating state within the ops/procedures.

This is one of the basic tradeoffs made in ParallelArray:
It knows how to translate fixed families of array operations
into underlying fork/join processing. While we can and should
keep adding to this family (as in supporting indexed procedures),
there will always only be a finite set of functional/procedural
forms that it understands.

When you need to go beyond them, the best recourse is to
step into the fun world of direct fork/join programming.
Often, it is fairly straightforward, as in the examples
(with more to come) in the RecursiveAction etc javadoc.
ParallelArray includes a bunch of tweaks that improve
performance over the basic templates (which it needs
in part because it must act without any programmer
supplied granularity information). The next update
(real soon now) will include documented, exposed
methods and classes that allow others to use them too,
but most of these can be ignored in everyday programming.

-Doug


More information about the Concurrency-interest mailing list