State of Loom
Ron Pressler
ron.pressler at oracle.com
Wed May 27 12:07:20 UTC 2020
Other languages -- e.g. Erlang and Go -- also have userspace threads. The
question is, then, why is it that some languages go for async/await. The answer
differs by language. Having a good GC, no pointers into the stack, little
reliance on FFI, and access to the low-level representation of compiled
subroutines are things that significantly help implementing userspace threads
satisfactorily. Many languages are limited by one or more of these factors.
Others, like Javascript, have had no prior form of threading, and introducing it
would have complicated matters considerably. Async/await is also much easier to
implement. Our implementation heavily relies on our GCs and, to a lesser
degree, on our JIT compilers.
Having said that, we did make some traeoffs. Our implementation is optimised for
a large number of threads, and would perform suboptimally for a small number of
coroutines whose workloads could fit in the CPU cache. We think that the former
use case is very compelling, and the latter not as much. There’s also a
footprint overhead, which could be significant, but on the other hand, the
implementation enjoys a relatively low allocation rate. I believe we’ll be able
to significantly reduce that footprint overhead over time (it’s mostly a matter
of investing effort, rather than some fundamental issue). There is no impact
Of any kind on code that does not block virtual threads.
— Ron
On 27 May 2020 at 01:56:08, Rob Nikander (rob.nikander at gmail.com(mailto:rob.nikander at gmail.com)) wrote:
> Hi,
>
> I read the State of Loom article and it sounds great. I’m wondering if it is going to be flat-out better than async/await or if there are tradeoffs. If all Java functions are going to be compiled to deal with this more dynamic “stack”, to avoid the two-colored world, does that mean that all Java functions (even those that don’t use async) will pay some performance penalty?
>
> I’m wondering if there is any reason to have colored functions in other languages, or if they should copy/steal this technique as well. :) Maybe it requires a VM/JIT/GC to work well.
>
> Rob
>
> On 2020-05-15 16:55, Ron Pressler wrote:
> > Hello.
> >
> > I’ve posted a document describing the project’s goals and current progress:
> >
> > http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html
> >
> > It is accompanied by a new EA build, based on jdk-15+21.
> >
> > http://jdk.java.net/loom/
> >
> > The new continuations algorithm is now switched on by default, so if you haven’t
> > explicitly turned it on before, you may see some performance improvements.
> > You can switch it off with -XX:-UseContinuationChunks.
> >
> > — Ron
> >
> >
> >
>
>
More information about the loom-dev
mailing list