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
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
posted
0
Thank you very much. That was very informational. Manasa