WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Since Microsoft didn't provide an option to automatically run the compiler/linker in low priority, I've figured a way that easily does this. What I have done is located in the vcspawn.exe executable, the call to CreateProcessA(). One of the parameters (dwCreationFlags) includes the priority at which you wish to run the created process. Vcspawn.exe normally runs everything with the dwCreationFlags set to 0x00000200, which decoded means use only the CREATE_NEW_PROCESS_GROUP flag. What I wish to include in the dwCreationFlags parameter is the flag, IDLE_PRIORITY_CLASS which is 0x00000040, so my replacement dwCreationFlags is 0x00000240 - a one byte difference. After making the simple one byte edit, all my builds are performed in low priority mode. Now you may think that by running at low priority, all your builds will take longer to complete, but you will be surprise at the little difference in actual build times, unless you were doing some other heavy duty task.
To make the one byte edit, first backup \Program Files\Microsoft Visual Studio\MSDev98\Bin\vcspawn.exe and then from inside DevStudio, open in BINARY mode, vcspawn.exe. Bring up the Go To dialog by typing, control-g, and key in the address 0x27ec and close the Go To dialog. The byte should be 00 with the previous byte being 68 and the following byte being 02. If they are not, then you are running a different version of vcspawn.exe and you shouldn't attempt the change. If they are, then you can just type in the replacement byte of 40. The new byte sequence starting at 0x27eb should now read 68 40 02. Save and close the file. Now all further builds will be performed in low priority.