RFR 8190974 Parallel stream execution within a custom ForkJoinPool should obey the parallelism

Stefan Zobel spliterator at gmail.com
Sat Nov 11 15:58:45 UTC 2017

In CustomFJPoolTest#testCustomPools()

>>    assertEquals(splitsForPC, splitsForPHalfC * 2);

I'm sure I'm slow on the uptake, but isn't this bound to
fail for every commonParallelism == 2^n + 1 in the closed
range [2, 127], i.e., for 3, 5, 9, 17, 33, 65?


2017-11-08 22:01 GMT+01:00 Paul Sandoz <paul.sandoz at oracle.com>:
> Hi,
> Please review this patch to ensure that a parallel stream obeys the parallelism of a custom fork join pool when it is executed within that pool:
>   http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8190974-par-stream-custom-pool/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8190974-par-stream-custom-pool/webrev/>
> Streams currently do not support capabilities to control the level of parallelism and therefore resources utilised (tricky API design problem to get right).
> At the moment the trick is to run stream executions within a custom pool, however the number of fork join tasks created will be in proportion to the parallelism of the common pool thus the execution will be over-provisioned. This can be especially noticeable on large machines with many cores.
> Paul.

More information about the core-libs-dev mailing list