File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes JVM threads Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "JVM threads" Watch "JVM threads" New topic
Author

JVM threads

Manasa Rao
Greenhorn

Joined: Apr 07, 2003
Posts: 6
JVM is supposed to use threads internally when any application is being executed. How do I know the list of all threads that JVM/OS is managing?
For example: I write a "Hello World" program. How do I find out what are the internal threads that JVM manages to execute the above program?
Please help me understand the multithreading concepts.
Thanks in advance,
Manasa
Greg Charles
Bartender

Joined: Oct 01, 2001
Posts: 1855

Well, there's always the main thread, which executes your application. There's a separate one for the garbage collector. If you run a GUI application, there's another handling events. Of course, there will also be any threads you started. Any decent debugger should show you what threads exists. Profilers, like OptomizeIt, can also display this information.
There are probably more low-tech, manual ways to get this information as well. (After all the debuggers and profilers must be getting it from somewhere.) The Thread class has an enumrate() method, which will show you all threads in the same ThreadGroup. You might also make a study of the -X options to the JVM. One of them might make thread information accessible. I prefer to rely on tools though.
Manasa Rao
Greenhorn

Joined: Apr 07, 2003
Posts: 6
Thank you very much. That was very informational.
Manasa
 
 
subject: JVM threads
 
Threads others viewed
Class Already Been Loaded
Number of Threads
When you run a program how many threads will create ?.
java.lang.OutOfMemoryError on server
No.of JVMs in one physical Machine
developer file tools