Mapping a missing native thread id to a thread dump
<p>How do I identify a thread in a java process when the native thread id doesn't match any of the threads listed in a thread dump?</p>

<p>Context:  Running on Windows, I'm currently using the Sysinternals Process Explorer to monitor the java.exe running the tomcat host for a webapp that we use in our lab.  We're currently watching this because the CPU profile has been crazy of late.</p>

<p>When the server is unresponsive, I look at the Properties of the java image, and switch to the thread tab, and order it by the CPU column.  There will typically be one TID - for example 62504 - parked at or near the top of the list.  I convert the TID to its hex representation (F428), check the thread dump - sure enough
   "VM Thread" prio=10 tid=0x33d45000 nid=0xf428 runnable</p>

<p>That makes me think that my method for mapping ids is adequate.</p>

<p>But because we're focused on CPU right now, I'm also interested in native thread 61136, which in an hour of running was more than 5 minutes of kernel time.  61136 -> 0xEED0, but none of my thread dumps ever include an nid=0xeed0 entry.</p>

<p><em>Edit: further testing reveals that StartAddress is a critical piece of information - all of the msvcr71.dll threads appear in the dump or have very short lifetime, but threads in other modules (mswsock.dll, kernel32.dll) do not appear.  The main thread comes from java.exe, but there are other threads in that module which do not appear in the thread dump.</em></p>
