Project Loom technical questions

Ignaz Birnstingl ignazb at gmail.com
Sat Jul 31 12:35:09 UTC 2021


Hello,

I have some questions regarding the motivation and some implementation  
specifics. I would appreciate if someone finds the time to answer.

1. The Proposal document [1] says that Fibers are more light-weight than  
kernel threads. I assume this means with regards to both memory and CPU  
footprint. What costs so much memory about a kernel thread? I assume the  
kernel needs some data structures to manage it (a couple of KB?), the  
stack and on the JVM side also some data structures, and the thread-local  
allocation buffers (TLABs).
With fibers you don't need the kernel data structures and the TLABs.  
Fibers still need the stack and JVM data structures.
Assuming the stacks could be managed similar to TLABs in that they start  
out really small and grow dynamically and the TLABs would/could be  
core-local allocation buffers instead, is there any significant memory  
overhead of kernel threads left?

2. Regarding scheduling: According to the user-level threads video [2]  
kernel scheduling is mainly costly because of the kernel scheduler doing  
its thing as opposed to context switches (which also occur when you do  
user-level scheduling).
I assume you are confident that the ForkJoinPool performs better than the  
kernel scheduler?

3. Regarding timed sleeps: Since the ForkJoinPool uses FIFO scheduling -  
would that imply some changes regarding sleeps, for example that under  
high-load scenarios sleeping fibers could wake up "later" on average than  
when using kernel threads?

-- 
Many thanks,
Ignaz

[1] https://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html
[2] https://www.youtube.com/watch?v=KXuZi9aeGTw


More information about the loom-dev mailing list