linux - Distinguishing between Java threads and OS threads? -
how distinguish running java threads , native threads?
in linux there parent process every child process, , 0 parent of process, there parent thread of forked java threads?
how know java thread related os thread (if java thread forkes native process thread).
is there naming convention of java threads , os threads?
can running java threads can suspended or killed java code?
on linux, java threads implemented native threads, java program using threads no different native program using threads. "java thread" thread belonging jvm process.
on modern linux system (one using nptl), threads belonging process have same process id , parent process id, different thread ids. can see these ids running ps -elf. pid column process id, ppid column parent process id, , lwp column thread (lightweight process) id. "main" thread has thread id that's same process id, , additional threads have different thread id values.
older linux systems may use "linuxthreads" threading implementation, not posix-compliant, instead of nptl. on linuxthreads system, threads have different process ids.
you can check whether system using nptl or linuxthreads running system's c library (libc) standalone program , looking under "available extensions" in output. should mention either "native posix threads library" or linuxthreads. path c library varies system system: may /lib/libc.so.6, /lib64/libc.so.6 (on 64-bit redhat-based systems), or /lib/x86_64-linux-gnu/libc.so.6 (on modern debian-based systems such ubuntu).
at os level, theads don't have names; exist within jvm.
the pthread_kill() c function can used send signal specific thread, use try kill specific thread outside jvm, don't know how jvm respond it. might kill whole jvm.
Comments
Post a Comment