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

Doug Lea dl at openjdk.org
Wed May 22 23:50:03 UTC 2024


On Wed, 22 May 2024 21:23:04 GMT, Sunmisc Unsafe <duke at openjdk.org> wrote:

>> After recheckiing, the best policy is to leave internal queues the same, but initialize external queues larger.
>
> Probably a misplaced post again, but why can't you allocate an array of arrays
> where the outer array is 30
> and the inner array will be doubled, 
> then the segment can be calculated by log(index)
> with: resize O(1), read/write O(1).
> 
> This approach can also be used in ConcurrentHashMap
> sample implementation 
> https://github.com/sunmisc/wormhole/blob/main/main/src/main/java/sunmisc/utils/concurrent/memory/ReferenceSegmentMemory.java
> 
> I don't know if this method exists anywhere else, I invented it, maybe it was invented before me.

Thanks for link to sample code link. I had tried something like this in an analogous case in SubmissionPublisher, but couldn't reduce overhead enough to be worthwhile. I may try again there first,m since resizing there is more common and disruptive.

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

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


More information about the core-libs-dev mailing list