Process Affinity Mask and Concurrency Runtime RRS feed

  • Question

  • We have a server application that uses PPL / concurrency runtime and developed in C++. We're currently using VS2010 and migrating to VS2012 soon.

    When attempting to scale our software to a many-core NUMA server, we found better results by creating a number of separate processes and setting the process affinity mask to put each process on a separate NUMA node. On our test server we have 4 nodes.

    However, we observed that the concurrency runtime modifies the process affinity on initialization. Stepping into the code, it seems that the thread affinity mask is being set to a wider affinity mask than the process, thereby extending the process affinity mask.

    We would not expect the concurrency runtime to modify process affinity. I expect it to want to control the thread affinity, but to respect the overall process affinity. Is this by design and/or is there anything we can do to prevent this happening?



    Thursday, November 7, 2013 8:22 PM


  • Hi David,

    Thanks for your question with regard to ConcRT support for process affinity mask.  This was addressed in Visual Studio 2012.  To quote this blog post, which was written back in the Visual Studio 2012 Beta timeframe:

    Also, the Resource Manager now respects process affinity mask set prior to the use of parallel libraries. One can also programmatically set this at the Resource Manager level by calling LimitTaskExecutionResources() API. This feature is particularly aimed at enabling server-side developers who would like to partition and dedicate CPU resources for each application.

    If you have any additional questions or clarifications, please feel free to post them on the forum.



    Monday, November 11, 2013 6:31 PM