Loom prototype available – fibers and delimited continuations for the JVM
mail.openjdk.java.net
mail.openjdk.java.net
https://aardvark179.github.io/blog/fibers.html/
https://medium.com/graalvm/bringing-fibers-to-truffleruby-1b...
> Building a correct highly concurrent scheduler is no easy task
I've been hearing that Java's ForkJoinPool is up to the task, and works well with Java's locking infrastructure.
> now can't have work stealing between your native threads
Indeed that is a concern, but as long as native stack frames make you fall back to regularly preempting an OS thread, the program will run. You're not having the performance boost for this workload, but your program does not crash; and is ready for some refactoring inside greenthread managed execution. This seems to be the current behavior of the Loom prototype.
> Next thing you realize is that you're still spending lots of memory on creating stacks for your green threads
We might be at the point where library writers can choose where to draw the line about stack, where and what to serialize. This is enabled by the delimited continuations.
> is that regular blocking IO (better yet mmaped IO) outperforms what most people are capable of achieving using the non-blocking disk IO facilities.
This calls for it to be managed inside the Standard Library.
----
Another comment down the line talks about a successful implementation in Erlang; with overhead size at 284 bytes. The current prototype has it at 200-240 [1], so this is already a win.
Coupled with the java.util.concurrent and Locks, I think it will go way beyond what Erlang is capable of. Message passing mandates copying and restricts code styles. And on top of that the JIT will bring in efficient CPU usage.