The Platform Builder build system is quite complicated but at the same time extremely powerful. In order to save valuable time during the compilation of our operating system image, it is necessary to know it in details so that we can avoid unnecessary operations. In addition, there are a number of "tricks" that allow us to make it much faster. Among these, there is the possibility to leverage the compilation on more "core" of our CPU, whereas all modern PCs have now from 2 "core" up.
The key of this possibility is the environment variable BUILD_MULTIPROCESSOR, whose meaning can be interpreted in the wrong way if you do not carefully read the documentation. Mistakenly, you might think that setting it to 0, the compilation on more "core" is disabled and vice versa activated by setting it to 1. It is not so!
Referring to the documentation on MSDN,, if you set the value to 0 you will let the system to automatically detect the number of "core" of the CPU and use all for the compilation by creating an appropriate number of threads, whereas if you set a number from 1 to N you explicitly set the number of threads to use.
Fortunately, the value 0 is the default, so in many cases we do not have to worry about change for maximum performance in compilation. Moreover, even if we wanted to change, it is provided an appropriate menu item in Visual Studio that we find in Tools -> Options -> Platform Builder.
To highlight the difference, I used a virtual machine (with Platform Builder for Windows Embedded Compact 2013 installed in Visual Studio 2012) with 4 cores. The first time, I compiled my image with BUILD_MULTIPROCESSOR = 1 and the result is a CPU that is not used more than 50%.
The second time I compiled using BUILD_MULTIPROCESSOR = 0 (default) and the result is a CPU used up to 100%.
In conclusion, it is important to know a variety of settings (sometimes hidden) that the Platform Builder puts at our disposal in order to perform our image compilation more quickly !
View this page in another language: