4

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?

2
  • Java threads do not have unique PIDs. They run as one process, so the only PID is for the entire JVM. Commented Oct 18, 2016 at 21:11
  • It's like a difference between process and thread. Commented Sep 6, 2019 at 5:05

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @AJNuefeld.
3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.