I’m porting a multi-thread application from Win32 to Linux.
In Win32 we use SetThreadIdealProcessor to set a ‘preferred’ processor for a thread, and I’m looking for help on providing a similar solution in Linux with pthread.
Note here: pthread_setaffinity_np in pthread.h is not a ‘good’ solution here, since it would limit the thread to run ONLY on the specified CPU set. Actually pthread_setaffinity_np is nearly equivalent to SetThreadAffinityMask function in Win32.
No such functionality exists in Linux. A processor is either in the mask of allowed processor or not.