Reputation: 46940
A different way to ask this question is "Is there ever a point to having more threads available to the application than there are cores?".
I have a total of 8 cores on my laptop. I just downloaded the latest version of VisualVM and clicked on the VisualVM
tab to see how it is performing. One of the things I noticed is that it's using 32 live threads and 22 daemon threads. Why is it using so many? IIUC using more than 8 is less efficient, and IIUC the JVM knows how many cores I have so it could just limit the total number of threads to 8.
Someone marked this as a duplicate, so I'll try to explain what I'm asking a little differently. I'm not asking how to use a particular feature of VisualVM. I'm asking why it is running more than 8 threads, since IIUC more than 8 would be less than optimal and VisualVM comes from Oracle so I figured they would design it to function optimally, so I'm wondering if I'm missing something, or is Oracle just allowing it to run with more threads than it should be running with?
Upvotes: 1
Views: 353
Reputation: 10184
Just because you have 50 threads of VisualVM running, it doesn't necessarily mean that all of those threads are supposed to be working actively at the same time. If you sort on the "Running" column, you will see that only the first 7 or 8 threads are actively running. The rests of the threads are sleeping or waiting for I/O.
Upvotes: 1