I am doing some research on language implementations on multicore platforms. Currently, I am trying to figure out a couple of things:
- How does a JVM implementation map a
java.lang.Thread
to an OS native thread? - For instance say Open JDK, I think I even do not know what parts I should take a look to read more about this. Is there any document describing how native features are implemented? Since there are parts in
java.lang.Thread
that are native, I assumed that maybe some more internal parts are coded in the native parts.
Taking this to multicore, how is this mapping done for multicore? How threads are mapped to different cores to run simultaneously? I know that there is ExecutorService
implementation that we can use to take advantage of multicore features. Here can come a consequence of the previous answers: If the OS native threads are responsible for work distribution and thread scheduling, then is it true to say that what JVM does through ThreadPool
and ExecutorService
is only creating threads and submitting tasks to them?
I'd be thankf开发者_开发知识库ul for your answers and also if I am on the right track on topic.
For instance say Open JDK, I think I even do not know what parts I should take a look to read more about this.
You should start by looking at the parts of the source code that are coded in C++. A C / C++ IDE might help you with the codebase exploration.
Taking this to multicore, how is this mapping done for multicore? How threads are mapped to different cores to run simultaneously?
I'm pretty sure that the operating system takes care of that aspect, not the JVM.
... is it true to say that what JVM does through ThreadPool and ExecutorService is only creating threads and submitting tasks to them?
AFAIK, yes.
精彩评论