6

AFAIK, it is possible to assign a thread to a CPU core in Linux. (see this). But, my question is can I achieve this functionality using boost and if it is possible, then how? Please, also not that OS can decide which is better for me, but assume that I want to control this behavior in my design.

Community
  • 1
  • 1
baris.aydinoz
  • 1,902
  • 2
  • 18
  • 28

3 Answers3

5

Boost is meant to be a cross platform library while the question you linked to points toward a OS specific implementation which to my knowledge is the only way to do what you are asking.

Andrew White
  • 52,720
  • 19
  • 113
  • 137
3

In Windows OS you can use SetThreadAffinityMask API call for this. I don't see how boost fits in what you need.

Edin Dazdarevic
  • 131
  • 2
  • 3
1

The topic is called "thread affinity", you could find the response by searching for this plus your exact operating system version.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115