RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Sun May 12 13:08:14 UTC 2024


On Fri, 10 May 2024 12:20:27 GMT, Doug Lea <dl at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 978:
>> 
>>> 976:      * of two, at least 2. See above.
>>> 977:      */
>>> 978:     static final int INITIAL_QUEUE_CAPACITY = 1 << 7;
>> 
>> @DougLea Interesting change—what impact did you notice when doubling this?
>
> The goal is to reduce the worst form of contention: when queue arrays are laid out adjacently in memory. Increasing sizes has some impact but with diminishing returns. Thanks for the comment as a reminder that I haven't rechecked this lately in light of other layout changes. Will do.

After recheckiing, the best policy is to leave internal queues the same, but initialize external queues larger.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597634199


More information about the core-libs-dev mailing list