[concurrency-interest] Introducing ForkJoinPool.commonPool

Dan Grossman djg at cs.washington.edu
Sat Nov 10 18:45:28 EST 2012


Just to chime in from my special-purpose prospective of using the ForkJoin
Framework to give second-year undergraduates a first, quick exposure to
parallelism, this is a very, very welcome addition.  Thanks!  (That said,
we're so happy that ForkJoin now works "out of the box" for vanilla Java 7
installations, that I plan to wait to take advantage of the common pool
until Java 8 releases.)

--Dan

On Tue, Oct 30, 2012 at 7:58 AM, Doug Lea <dl at cs.oswego.edu> wrote:

>
> Several converging considerations led to the introduction
> of a (static) commonPool available in ForkJoinPool.
> The common pool always exists (but takes up only around 100bytes
> if never used), and is now the default target for any
> invocation of ForkJoinTask.{fork, invoke} if the caller is
> not itself executing in a given pool. In other words,
> ForkJoinTask methods that before threw exceptions because
> the caller was not operating in a pool now succeed, using
> the commonPool. (This is a spec change, but an innocuous
> and desirable one -- a previously illegal use is now legal.)
>
> Among other niceties, this means you can use ForkJoinTasks
> without even knowing about class ForkJoinPool. But you
> can still of course always create your own pools and
> explicitly submit to them if you need isolation or custom
> parameters.
>
> As indicated in the javadocs, you can set construction
> parameters for the commonPool using Properties.
>
> In addition to simplifying usage, introducing a commonPool
> allows some internal optimizations (as well as a few
> new support methods, for example CountedCompleter.helpComplete)
> that could not be supported as well from outside of
> the ForkJoinPool class.
>
> It seems likely that bulk parallel operation support in
> JDK8, Scala, etc., will change to use the commonPool.
> The updated ConcurrentHashMap (JDK8 or V8) class already does so.
>
> The updates are now in all packagings (jsr166y, jsr166e,
> and JDK8 java.util.concurrent). See the usual links:
>
> JDK8 java.util.concurrent:
>     API specs: http://gee.cs.oswego.edu/dl/**jsr166/dist/docs/<http://gee.cs.oswego.edu/dl/jsr166/dist/docs/>
>     jar file: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166.jar<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar>
>     Browsable CVS sources: http://gee.cs.oswego.edu/cgi-**
> bin/viewcvs.cgi/jsr166/src/**main/java/util/<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/>
>
> jsr166e:
>     API specs: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166edocs/<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/>
>     jar file: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166e.jar<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166e.jar>(compiled using Java7 javac).
>     Browsable CVS sources: http://gee.cs.oswego.edu/cgi-**
> bin/viewcvs.cgi/jsr166/src/**jsr166e/<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/>
>
> jsr166y:
>     API specs: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166ydocs/<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/>
>     jar file: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166y.jar<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166y.jar>(compiled using Java6 javac).
>     Browsable CVS sources: http://gee.cs.oswego.edu/cgi-**
> bin/viewcvs.cgi/jsr166/src/**jsr166y/<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166y/>
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20121110/f91f6f2d/attachment.html>


More information about the Concurrency-interest mailing list