I do not want to state an incomplete XY problem, so here's the full situation:


I am running builds in Visual Studio on my Windows 7 machine, using both parallel builds and parallel compilation. Disabling either of these is not an option.

My problem is that occasionally, this spawns so many cl.exe (compiler) processes that the whole machine slows down, UI gets unresponsive etc.

The machine has 12 effective cores (6 w/hyperthreading).


My idea to solve this problem is to restrict cl to only 11 or 10 of the cores available, so that it cannot turn the whole machine unresponsive. Unfortunately, I was not able to find a way to do so.

I've found ways to set application affinity by using a shortcut (.lnk) to the application, but that is not applicable in my situation because cl.exe is launched by Visual Studio internally, and not directly by me.

I've also found ways of setting the affinity of a process already running, but that's not useful for me either (if nothing else, the cl.exe processes end and get spawned throughout the build, they're not long-running ones).

I am looking for a way to do the Y part, but alternative ways to solve the X problem (unresponsiveness caused by too many processes running, stopping, and starting) are welcome solutions as well.

  • Can't you just lower number of parallel builds? msdn article
    – PTwr
    Feb 10, 2016 at 10:39
  • @PTwr Unfortunately, no. As I mentioned, it's a combination of parallel builds (what the MSDN thing talks about) and parallel compilation (/MP switch). And I can't get rid of either one, because the builds also involve Fortran, which only has parallel builds. Feb 10, 2016 at 10:55
  • Ah, then I guess it will be just question of setting permanent affinity then. I think I used tool like this or something similar in past. Or you can set up virtual machine with limited cores ;)
    – PTwr
    Feb 11, 2016 at 9:36
  • @PTwr That sounds like an answer to me - basically, my question is "how to set parmanent affinity?" This makes "with this free tool" a valid answer IMO. Feb 11, 2016 at 10:11
  • I would prefer to test it first by myself, for now its just random memory recall.
    – PTwr
    Feb 11, 2016 at 10:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.