3 ms·
> The second part of the answer is that there are still good uses cases for heavyweight threads, that are backed by one OS thread. Hold the phone. Didn't you j
by ragnese 6y ago
> The second part of the answer is that there are still good uses cases for heavyweight threads, that are backed by one OS thread.
Hold the phone. Didn't you just say a few comments up that I shouldn't think of a "Java thread" like an "OS thread"?
If I use a Thread, today, how do I know if it's corresponding to an OS thread? I understand that it will, theoretically, depend on the platform on which the JVM is running. But on a non-exotic platform (x86/ARM Windows, Linux, macOs, Android, etc), does one Java Thread map to one OS Thread or not?
- pron 6y agoI meant that a Java thread, like the List interface, is an abstraction with multiple implementations for you to choose from. In OpenJDK (i.e. the Oracle implementation of Java) today, a Java thread is implemented as a wrapper of an OS thread; I believe OpenJ9, the IBM implementation, does the same. But the Java specification does not require it. Loom might change the specification to require it, or leave the implementation of "platform threads" (i.e. non-virtual threads) up to the specific Java implementation.