Search code examples
javamultithreadingperformancemulticore

Check which thread is running on which CPU in linux


I'm interested in finding which thread is running on which core/CPU. My Tomcat6 is using a single CPU core 100% and all other CPUs (my server has 16 other cores idle) are not being utilized... so I'm trying to figure out what went wrong.


Solution

  • Funny that people downvotes but don't tell why. I searched for a while and found that following command gives which thread running on which CPU:

    ps -p <PID> -L -o pid,tid,psr
    

    Where < PID > is the pid of the process we are interested in.