Get process and thread affinity mask on Linux

On Windows, there exists the GetProcessAffinityMask API call, and there also exists a roundabout way of finding the thread affinity mask, seen here:

Query thread (not process) processor affinity?

Is there any way of getting this information in Linux? A call to sched_getcpu() returns only the cpu that the thread is currently running on, not its affinity mask.


sched_setaffinity() & sched_getaffinity().

pthread_attr_setaffinty_np() & pthread_attr_getaffinity_np().

pthread_setaffinity_np() & pthread_getaffinity_np().

The _np stands for non-portable.

链接地址: http://www.djcxy.com/p/56104.html

上一篇: 整个一个核心致力于单一过程

下一篇: 在Linux上获取进程和线程关联掩码