RFR: JDK-8319662 ForkJoinPool trims worker threads too slowly
Viktor Klang
vklang at openjdk.org
Mon Nov 20 14:31:59 UTC 2023
On Mon, 20 Nov 2023 13:31:42 GMT, Doug Lea <dl at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2140:
>>
>>> 2138: Thread.interrupted(); // clear for next park
>>> 2139: if (deadline != 0L && // try to trim on timeout
>>> 2140: deadline - System.currentTimeMillis() < TIMEOUT_SLOP) {
>>
>> Since `currentTimeMillis()` is fetched from system time, I think it might be more appropriate to use nanoTime() to track delays.
>
> It would be better, but absolute-time Unsafe.park only operates at millisecond accuracy (and even at that may misfire early, requiring TIMEOUT_SLOP.)
I was thinking more about cases where system clock moves backwards in time. (currentTimeMillis() isn't spec:ed to be monotonic, right?)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16725#discussion_r1399283296
More information about the core-libs-dev
mailing list