Will a java thread have a unique PID in UNIX environment? If I want to kill a specific thread of execution , is it possible to be done outside the program?
-
Java threads do not have unique PIDs. They run as one process, so the only PID is for the entire JVM.Elliott Frisch– Elliott Frisch2016-10-18 21:11:54 +00:00Commented Oct 18, 2016 at 21:11
-
It's like a difference between process and thread.SaviNuclear– SaviNuclear2019-09-06 05:05:37 +00:00Commented Sep 6, 2019 at 5:05
Add a comment
|
2 Answers
Oracle includes jvisualvm in the JDK\bin directory. You can use it to view threads running inside running JVM's. However, I don't see any support for terminating a thread.
1 Comment
Punter Vicky
Thanks @AJNuefeld.
Here they say Most implementations of the Java virtual machine run as a single process. A Java application can create additional processes using a ProcessBuilder object. The alternative would be spawn a process instead of a thread.