[concurrency-interest] ForkJoin updates

Doug Lea dl at cs.oswego.edu
Fri Mar 25 11:07:04 EDT 2022


Upcoming updates for ForkJoin{Pool,Task} are mainly designed to make 
things better for loom (faster initialization, improved handling of 
async tasks, less memory and signal contention, a few nichy methods). 
They also include new method ForkJoinPool.setParallelism (see 
http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/concurrent/ForkJoinPool.html) 
that allows dynamic changes in target parallelism. I had resisted this 
because of the uncertainty it adds (and internally structured code in a 
way that made it impossible without a lot of refactoring). But  now is 
the time to let go of this: Virtualized platforms now routinely give 
different answers at different times about available processors, and 
projects like crac (https://wiki.openjdk.java.net/display/crac) need to 
be able to dynamically update. There are no supported automated ways to 
do these, but allowing it makes it possible for others to explore them.

Comments and suggestions are welcome. You may be able to try these out 
now in jdk17+ by grabbing a jsr166.jar 
(http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar) and using: java 
--patch-module java.base="$DIR/jsr166.jar",

-Doug




More information about the Concurrency-interest mailing list