IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this blog will no longer be available. More details available on our FAQ.

Comments (4)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (4)

cggibbo commented May 26 2015 Comment Permalink

Hi Leo, I asked around about this. The suggestion was to use trace or look at runq. runq is not 100% right all the time but should be close enough. e.g. (0)> th 736 | head SLOT NAME STATE TID PRI RQ CPUID CL WCHAN pvthread+02E000 736!ksh RUN 2E0000D 061 10 257 This shows the cpu to which the thread is affinitied. Which almost always will be the cpu that it last ran on. I hope that helps.

leo-pontusvision commented May 12 2015 Comment Permalink

Hi Chris, I know this is quite an old post, but I was wondering whether you were ever able to find the last processor where a pid (or even better lwp) was running. I'm porting an app from Linux to AIX, and that information is quite critical to the port. Kind Regards, Leo.

cggibbo commented July 6 2011 Comment Permalink

Thanks Glukacs1. Yes, if you bind a process to a logical processor, it's easy to find out which processor number your process is running on. But if you are not using bindprocessor....then I don't know. So far, trace is the only tool that seems to provide this information. I'll keep looking and if I find out I will update this post. Thanks again for your feedback.

Glukacs1 commented July 1 2011 Comment Permalink

Hi Chris. I know only one online way to check this in case you specified the CPU for a PID (like you did with the bindprocessor): Under kdb you can you use the 'tpid -d [PID]' command like that way: # ps -ef |grep db2 root 5701816 1 0 17 Jun - 0:24 /usr/opt/db2_08_01/bin/db2fmcd # bindprocessor 5701816 3 ps -o THREAD -p 5701816 USER PID PPID TID ST CP PRI SC WCHAN F TT BND COMMAND root 5701816 1 - A 0 60 1 f1000110095cacb0 240401 - 3 /usr/opt/db2_08_01/bin/db2fmcd # kdb .... (0)> tpid -d 5701816 SLOT NAME STATE TID PRI RQ CPUID CL WCHAN pvthread+00D800 216 db2fmcd SLEEP D800B3 03C 3 00003 0 F1000110081F78B0