Re: ForkJoin updates
Dmitry Zaslavsky via Concurrency-interest <[email protected]> Sun, 27 Mar 2022 21:33:11 -0400
| Newsgroups | gmane.comp.java.jsr.166-concurrency |
|---|---|
| Message-ID | <[email protected]> |
--===============8645340298051369322== Content-Type: multipart/alternative; boundary="Apple-Mail=_024A7DA7-8891-41F4-BEAD-0A6143FDC8CE" --Apple-Mail=_024A7DA7-8891-41F4-BEAD-0A6143FDC8CE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii FJP is still used a pool for carrier threads. Loom/Virtual threads still need a carrier thread to execute on and FJP = can/should be used for that. As far as FJP is concerned a virtual thread is scheduled as a task. > On Mar 25, 2022, at 11:11 AM, Nathan Reynolds via Concurrency-interest = <[email protected]> wrote: >=20 > 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? >=20 > On Fri, Mar 25, 2022 at 9:09 AM Doug Lea via Concurrency-interest = <[email protected] = <mailto:[email protected]>> wrote: > Upcoming updates for ForkJoin{Pool,Task} are mainly designed to make=20= > things better for loom (faster initialization, improved handling of=20 > async tasks, less memory and signal contention, a few nichy methods).=20= > They also include new method ForkJoinPool.setParallelism (see=20 > = http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/concurren= t/ForkJoinPool.html = <http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/concurre= nt/ForkJoinPool.html>)=20 > that allows dynamic changes in target parallelism. I had resisted this=20= > because of the uncertainty it adds (and internally structured code in = a=20 > way that made it impossible without a lot of refactoring). But now is=20= > the time to let go of this: Virtualized platforms now routinely give=20= > different answers at different times about available processors, and=20= > projects like crac (https://wiki.openjdk.java.net/display/crac = <https://wiki.openjdk.java.net/display/crac>) need to=20 > be able to dynamically update. There are no supported automated ways = to=20 > do these, but allowing it makes it possible for others to explore = them. >=20 > Comments and suggestions are welcome. You may be able to try these out=20= > now in jdk17+ by grabbing a jsr166.jar=20 > (http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar = <http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar>) and using: java=20 > --patch-module java.base=3D"$DIR/jsr166.jar", >=20 > -Doug >=20 >=20 > _______________________________________________ > Concurrency-interest mailing list > [email protected] = <mailto:[email protected]> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest = <http://cs.oswego.edu/mailman/listinfo/concurrency-interest> > _______________________________________________ > Concurrency-interest mailing list > [email protected] > http://cs.oswego.edu/mailman/listinfo/concurrency-interest --Apple-Mail=_024A7DA7-8891-41F4-BEAD-0A6143FDC8CE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div = class=3D"">FJP is still used a pool for carrier threads.</div><div = class=3D"">Loom/Virtual threads still need a carrier thread to execute = on and FJP can/should be used for that.</div><div class=3D"">As far as = FJP is concerned a virtual thread is scheduled as a task.</div><div = class=3D""><br class=3D""></div><div class=3D""><br class=3D""><div><br = class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On Mar = 25, 2022, at 11:11 AM, Nathan Reynolds via Concurrency-interest <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" = class=3D"">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?<br = class=3D""></div><br class=3D""><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 <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:<br = class=3D""></div><blockquote class=3D"gmail_quote" style=3D"margin:0px = 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex">Upcoming updates for = ForkJoin{Pool,Task} are mainly designed to make <br class=3D""> things better for loom (faster initialization, improved handling of <br = class=3D""> async tasks, less memory and signal contention, a few nichy methods). = <br class=3D""> They also include new method ForkJoinPool.setParallelism (see <br = class=3D""> <a = href=3D"http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/c= oncurrent/ForkJoinPool.html" rel=3D"noreferrer" target=3D"_blank" = class=3D"">http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java.base/java/uti= l/concurrent/ForkJoinPool.html</a>) <br class=3D""> that allows dynamic changes in target parallelism. I had resisted this = <br class=3D""> because of the uncertainty it adds (and internally structured code in a = <br class=3D""> way that made it impossible without a lot of refactoring). But now = is <br class=3D""> the time to let go of this: Virtualized platforms now routinely give <br = class=3D""> different answers at different times about available processors, and <br = class=3D""> projects like crac (<a href=3D"https://wiki.openjdk.java.net/display/crac"= rel=3D"noreferrer" target=3D"_blank" = class=3D"">https://wiki.openjdk.java.net/display/crac</a>) need to <br = class=3D""> be able to dynamically update. There are no supported automated ways to = <br class=3D""> do these, but allowing it makes it possible for others to explore = them.<br class=3D""> <br class=3D""> Comments and suggestions are welcome. You may be able to try these out = <br class=3D""> now in jdk17+ by grabbing a jsr166.jar <br class=3D""> (<a href=3D"http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar" = rel=3D"noreferrer" target=3D"_blank" = class=3D"">http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar</a>) and = using: java <br class=3D""> --patch-module java.base=3D"$DIR/jsr166.jar",<br class=3D""> <br class=3D""> -Doug<br class=3D""> <br class=3D""> <br class=3D""> _______________________________________________<br class=3D""> Concurrency-interest mailing list<br class=3D""> <a href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a><br class=3D""> <a href=3D"http://cs.oswego.edu/mailman/listinfo/concurrency-interest" = rel=3D"noreferrer" target=3D"_blank" = class=3D"">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><= br class=3D""> </blockquote></div> _______________________________________________<br = class=3D"">Concurrency-interest mailing list<br class=3D""><a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a><br = class=3D"">http://cs.oswego.edu/mailman/listinfo/concurrency-interest<br = class=3D""></div></blockquote></div><br class=3D""></div></body></html>= --Apple-Mail=_024A7DA7-8891-41F4-BEAD-0A6143FDC8CE-- --===============8645340298051369322== 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 --===============8645340298051369322==--