Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Count in Task Manager  RSS feed

 
Bharat Nayak
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If, I run following code, the task manager shows 8 threads (thread count), why?

public static void main (String args[]) {
try {
Thread.sleep(10000);
} catch (Exception iex) {
}
}

Any idea why does it happen?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you run a JVM (launched when you run a class using "java"), there are a few threads that the JVM runs on its own like Finalizer, GC thread, etc.
So, you will always have more threads than the number you have started.
At any moment of time you can take a thread dump(CTRL-Break) of the JVM to get the details of the threads that are running in a particular JVM
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!