I am a big fan of speeding up my builds using "make -j8" (replacing 8 with any of my current kernel computer numbers, of course), and compiling N files in parallel is usually very effective at shortening compilation times ... if some of the compilation processes are not intensive enough for memory, because the RAM runs out on the computer, and in this case all the different compilation processes begin to replace each other, and everything slows down to bypass - thus, defeating the target, first perform parallel compilation.
Now, the obvious solution to this problem is to "buy more RAM", but since I'm too cheap for this, it seems to me that it should be able to implement a "make" (or equivalent) that monitors the available RAM of the system, and when RAM becomes almost zero, and the system begins to replace, make automatically turns on and sends SIGSTOP to one or more compilation processes that it spawned. This would completely stop processing stopped processes so that other processes can complete their compilation without further replacement; then, when other processes exit and more RAM becomes available, the make process sends SIGCONT to paused processes, allowing them to resume their own processing. In this way, most exchanges could be avoided, and I could compile all the kernels.
Does anyone know of a program that implements this logic? Or, conversely, is there a good reason why such a program will not / cannot work?
source share