4

I am working in Java code. My code makes specific Java threads run on specific cores. In this code, I give names to Java threads. I need a Linux command that enables me to know the threads' names that run on a specific core.

I use ps -mo pid,tid,fname,user,psr -p command, so I know the name of the process (java), but I do not know the name corresponding to tid to check if the specific thread runs on the core that I determine for that thread.

4

How about ps -eL -o user,pid,psr,comm,args.

psr field gives you the processor currently assigned to that thread.

0

As far as I found out unix tools are not able to retrieve Java thread names.

What helped in my case was:

<JDK_HOME>/bin/jcmd 52037 Thread.print

Check jcmd documentation for more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.