Re: ForkJoin updates

Nathan Reynolds via Concurrency-interest <[email protected]> Fri, 25 Mar 2022 09:11:47 -0600
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <CALMUwcrY2ZhDDDooNLFxtrCFwyiqSRe-hwuOugwa6q2eyUiVJA@mail.gmail.com>
--===============8001888553914813834==
Content-Type: multipart/alternative; boundary="0000000000005b73b905db0c6224"

--0000000000005b73b905db0c6224
Content-Type: text/plain; charset="UTF-8"

I figure with Loom threads that ForkJoinPool would simply launch a new
thread whenever there is work that can be done.  I am guessing that
ForkJoinPool still limits threads.  Is this because ForkJoinPool is
typically used for threads that don't block?

On Fri, Mar 25, 2022 at 9:09 AM Doug Lea via Concurrency-interest <
[email protected]> wrote:

> 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
>
>
> _______________________________________________
> Concurrency-interest mailing list
> [email protected]
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>

--0000000000005b73b905db0c6224
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I figure with Loom threads that ForkJoinPool would simply =
launch a new thread whenever there is work that can be done.=C2=A0 I am gue=
ssing that ForkJoinPool still limits threads.=C2=A0 Is this because ForkJoi=
nPool is typically used for threads that don&#39;t block?<br></div><br><div=
 class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Mar 25=
, 2022 at 9:09 AM Doug Lea via Concurrency-interest &lt;<a href=3D"mailto:c=
[email protected]">[email protected]</a>&g=
t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Upcomi=
ng updates for ForkJoin{Pool,Task} are mainly designed to make <br>
things better for loom (faster initialization, improved handling of <br>
async tasks, less memory and signal contention, a few nichy methods). <br>
They also include new method ForkJoinPool.setParallelism (see <br>
<a href=3D"http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util=
/concurrent/ForkJoinPool.html" rel=3D"noreferrer" target=3D"_blank">http://=
gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/concurrent/ForkJo=
inPool.html</a>) <br>
that allows dynamic changes in target parallelism. I had resisted this <br>
because of the uncertainty it adds (and internally structured code in a <br=
>
way that made it impossible without a lot of refactoring). But=C2=A0 now is=
 <br>
the time to let go of this: Virtualized platforms now routinely give <br>
different answers at different times about available processors, and <br>
projects like crac (<a href=3D"https://wiki.openjdk.java.net/display/crac" =
rel=3D"noreferrer" target=3D"_blank">https://wiki.openjdk.java.net/display/=
crac</a>) need to <br>
be able to dynamically update. There are no supported automated ways to <br=
>
do these, but allowing it makes it possible for others to explore them.<br>
<br>
Comments and suggestions are welcome. You may be able to try these out <br>
now in jdk17+ by grabbing a jsr166.jar <br>
(<a href=3D"http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar" rel=3D"nore=
ferrer" target=3D"_blank">http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.ja=
r</a>) and using: java <br>
--patch-module java.base=3D&quot;$DIR/jsr166.jar&quot;,<br>
<br>
-Doug<br>
<br>
<br>
_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Con=
[email protected]</a><br>
<a href=3D"http://cs.oswego.edu/mailman/listinfo/concurrency-interest" rel=
=3D"noreferrer" target=3D"_blank">http://cs.oswego.edu/mailman/listinfo/con=
currency-interest</a><br>
</blockquote></div>

--0000000000005b73b905db0c6224--

--===============8001888553914813834==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

--===============8001888553914813834==--