I have custom build system written in PHP. It's similar to make tool, gathering source files with dependencies to compile and link them.
It uses system function to run G++, like this:
system("g++ -c $file -o $out");
It's working great. However I have a multi-core processor and I would like to use those extra cores to speed up the process (like make -j 8). How can I do it in PHP? I don't need to have multithreading in PHP per se, I just need to spawn few child processes and wait for them to complete.