[concurrency-interest] In-progress ParallelArray changes

Doug Lea dl at cs.oswego.edu
Mon Jan 7 11:05:44 EST 2008


After a few distractions, the "version 2" ParallelArray API files
are now available. See the usual places:

API specs:  http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/
jar file: http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166y.jar
CVS sources: http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166y/

Below is pasted reminder about main changes.
Which forgot to mention full cascade support:
   pa.withFilter(p1).withFilter(p1).withMapping(m1).withMapping(m2)...
(Yes, I did once say that I wasn't going to do this, but decided
that people were right about it being very inconvenient to do this
manually.)

Also, here are a few questions for those of you using these APIs.

1. It is now easy to use the default global ForkJoinExecutor,
but should it be made even easier, by supporting static factory
methods that omit it as an argument? The main reason for making
people pay attention to the executor argument is to force at least
a bit of thought about whether you need isolation from other parts
of a system that might be abusing the default pool.

2. The prefix classes (WithFilter, WithMapping etc) do not themselves
support support Iterable. So for example, to iterate through some,
you'd need to do pa.withFilter(pred).all().iterator(). This is not
done to be annoying, but because there are two perfectly reasonable
expectations people might have about constructions like:
   for(T e: pa.withFilter(pred)) ...
Since iterators are sequential, should this mean to just
sequentially evaluate filters as elements are produced, or
should it perform a full parallel mapping first, and then produce
the iteration elements without further processing? Currently, there
is no way to obtain the first behavior. Should there be?



Doug Lea wrote:
> 
> * A full-featured List view accessed via asList: 
> * Static factory methods instead of constructors
> * A static defaultExecutor method 
> * Elimination of "Int" specializations. 
> * Better support for set-like operations: allUniqueElements,
>    WithFilter.removeAll, binarySearch on sorted arrays, and
>    a few others.
> * A few method renamings to make the above a bit more consistent.
> * Corresponding changes to ParallelDoubleArray and ParallelLongArray
>  


More information about the Concurrency-interest mailing list