Is there a one to one mapping between Java Thread objects and OS threads (Lightweight processes). That is, if I have a Thread object, can I always identify precisely one associated OS thread, and will I always have the same associated OS thread? In general this is OS and JVM dependent, so I'll restrict the question to Linux with the Oracle and Open JDK JVMs.
What about the cases of sleeping or waiting threads? And the corner cases of threads that have not started running and those that have finished running?
解决方案
Is there a one to one mapping between Java Thread objects and OS threads (
Yes there is, it has been since Java 1.2.
Prior to Java 1.2 a "green threads" model were used which mapped several Java threads to one OS thread.