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,874
  • 2
  • 17
  • 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
  • 51,542
  • 18
  • 111
  • 135
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
  • 121
  • 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,038
  • 8
  • 71
  • 112