Search code examples
linuxlinux-kernelembedded-linuxaffinitysmp

How to find the thread affinity in Linux other than using the affinity mask?


We have an embedded MIPS 2-core processor running SMP Linux (2.6.18).

We are planning to assign the affinity of the main GUI threads to one of the two cores, and the other core used for driver/data path processing.

However, the questions has been asked of how do you tell which threads are on which core?

I can get the affinity mask fine, but is there any other way of telling (e.g. /proc system) which threads are on which core?

Thanks.


Solution

  • sched_getcpu - determine CPU on which the calling thread is running

       man sched_getcpu()