No subject
Sohail Khan
ksohail990 at gmail.com
Sun Apr 25 20:21:59 UTC 2021
Hello Loom Dev,
Thanks a lot for your great work on Project Loom. I am really excited
about Project Loom.
I had a couple of questions that I felt you could answer and help me. My
questions are in the context of Linux OS and IO.
1. Current implementation of Java Threads are wrappers around Native
Threads. In linux, threads are Process sharing Virtual Address Space
allocated to the parent process. If a Java thread makes a blocking
system call like Read() on a file descriptor, scheduler adds it to the Wait
Queue, to be awakened later. When running in virtual threads. blocking it
could be detrimental to the entire JVM. Is my understanding correct?. If
it's correct then the only IO allowed from Virtual Thread will be
non-blocking syscalls, any traditional API that uses blocking under the
hood will need to be invoked from a non virtual thread.
2. SInce JVM will be doing scheduling, will Java Compiler add bytecodes
to the task definition, to indicate the JVM to context switch a new virtual
thread on the native thread. This would lead the JVM to save all the
context, call stack in Data Structure and allocate a new executable task to
the native thread. Is my understanding correct?
3. Will Java Scheduler Implement TIme Slicing, between competing CPU
bound executable tasks or the preferred way of executing them would be to
use existing ForkJoin Pool. Also in case if Java implements preemptive
scheduling using time slicing, how will JVM interrupt the process as its
running in the user space
4. As of today Netty is one very popular wrapper around Java NIO, that
relies on Event Loops. Will JVM Internally implement event loops for
Project Loom, because availability of data on Socket buffers could make a
task executable again.
I was just trying to understand this topic in detail and seeking your help
to do it. Thanks a lot for the help.
I am not a JDK developer but just someone who has keen passion in
understanding this topic and hopefully someday try contributing back as
well to the community.
Thanks and Regards
Sohail Khan
More information about the loom-dev
mailing list