title: With Gulp 4+, when using gulp.parallel(), is there a way of using multiple CPUs for the concurrent tasks?
body: <p>I am considering using gulp.parallel() to concurrently run build tasks. When I tried a toy example, I found that only 1 CPU core (1 gulp process seen when I run top) is running all the tasks. Here is my toy example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { parallel } = require('gulp');
  
  function javascript(cb) {
    setTimeout(function() {
     console.log("Javascript task!")
     cb();
   }, 20000);
  }
  
  function css(cb) {
    setTimeout(function() {
     console.log("CSS task!")
     cb();
   }, 10000);
  }
  
  function prettify(cb) {
    setTimeout(function() {
     console.log("Prettify task!")
     cb();
   }, 15000);
  }
  
  function colorize(cb) {
    setTimeout(function() {
     console.log("Colorize task!")
     cb();
   }, 5000);
  }
  
  
  function defaultTask(cb) {
    // place code for your default task here
    cb();
  }
  
  exports.default = defaultTask
  exports.build = parallel(javascript, css, prettify,colorize);</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I do a "gulp build" I see the tasks running concurrently (total run time of the above example is 20s for all 4 tasks), but I see only one gulp process executing the 4 tasks.</p>
  
  <p>I am hoping to utilize a multi-core CPU to speed up my gulp builds. Hence the question - are there any ways of utilizing multiple cores for a gulp task? I have looked at "<a href="https://www.npmjs.com/package/gulp-multi-process" rel="nofollow noreferrer">gulp-multi-process</a>" and this does spawn multiple processes when "gulp multi" is run against the gulpfile.js shown below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { parallel } = require('gulp');
  var gulp = require('gulp');
  var gulpMultiProcess = require('gulp-multi-process');
  
  function javascript(cb) {
    setTimeout(function() {
     console.log("Javascript task!")
     cb();
   }, 20000);
  }
  
  function css(cb) {
    setTimeout(function() {
     console.log("CSS task!")
     cb();
   }, 10000);
  }
  
  function prettify(cb) {
    setTimeout(function() {
     console.log("Prettify task!")
     cb();
   }, 15000);
  }
  
  function colorize(cb) {
    setTimeout(function() {
     console.log("Colorize task!")
     cb();
   }, 5000);
  }
  
  
  gulp.task("javascript",javascript);
  gulp.task("css",css);
  gulp.task("prettify",prettify);
  gulp.task("colorize",colorize);
  
  function defaultTask(cb) {
    // place code for your default task here
    cb();
  }
  
  gulp.task('multi', function(cb) {
    // task1 and task2 will run in different processes
    return gulpMultiProcess(["javascript","css","prettify","colorize"], cb);
  });
  
  exports.default = defaultTask
  exports.build = parallel(javascript, css, prettify,colorize);</code></pre>
  </div>
  </div>
  </p>
  
  <p><em>...but is there any other option for gulp to spin up multiple processes as well?</em></p>