multithreading - How Java multi-threaded program is able to use multiple CPU cores? -
could please provide explanation how java multi-threaded program (e.g. tomcat servlet container) able use cores of cpu when jvm single process on linux? there in-depth article describes subject in details?
edit #1: i'm not looking advice how implement multi-threaded program in java. i'm looking explanation of how jvm internally manages use multiple cores on linux/windows while still being single process on os.
edit #2: best explanation managed find hotspot (sun/oracle jvm) implements threads native threads on linux using nptl. more less each thread in java lightweight process (native thread) on linux. visible using ps -elf command print outs not process id (ppid) native thread id (lwp).
more details can found here:
- http://www.velocityreviews.com/forums/t499841-java-5-threads-in-linux.html
- distinguishing between java threads , os threads?
edit #3: wikipedia has short nice entry on nptl further references http://en.wikipedia.org/wiki/native_posix_thread_library
the linux kernel supports threads first-class citizens. in fact kernel thread isn't different process, except shares address space thread/process.
some old versions of ps showed separate process each thread default , newer versions can enable behavior using -m flag.
Comments
Post a Comment