RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17]

Doug Lea dl at openjdk.org
Fri May 31 14:32:06 UTC 2024


On Fri, 31 May 2024 14:08:49 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reconcile changes
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2075:
> 
>> 2073:             }
>> 2074:             if (p != phase &&                    // check quiescent termination
>> 2075:                 ((runState & SHUTDOWN) == 0L || quiescent() <= 0)) {
> 
> @DougLea `runState` is a volatile, so this change implies a slight difference in memory effects from the `qc` check, I presume this is intentional? 🤔

Yes. This check makes termination a bit faster because SHUTDOWN is also true if STOP, (as quiescent() will report)  so avoids enough spins and rechecks to be worth the extra read.

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

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


More information about the core-libs-dev mailing list