Create some concurrent workers that process the tasks simultaneously.
439222
def collect(self):
        
        collected = super(Command, self).collect()
        if self.faster:
            self.worker_spawn_method()
            self.post_processor()
        return collected
5135
void processBatchWaitTasks() {
		Channel channel = context.registry.getChannelOrSystem(Model.CHANNEL_BATCH); // channel TedBW or TedSS
		int maxTask = context.taskManager.calcChannelBufferFree(channel);
		Map<String, Integer> channelSizes = new HashMap<String, Integer>();
		channelSizes.put(Model.CHANNEL_BATCH, maxTask);
		List<TaskRec> batches = context.tedDao.reserveTaskPortion(channelSizes);
		if (batches.isEmpty())
			return;

		for (final TaskRec batchTask : batches) {
			channel.workers.execute(new TedRunnable(batchTask) {
				@Override
				public void run() {
					processBatchWaitTask(batchTask);
				}
			});
		}
	}
373369
def _create_worker(self, method, *args, **kwargs):
        """"""
        thread = QThread()
        worker = RequestsDownloadWorker(method, args, kwargs)
        worker.moveToThread(thread)
        worker.sig_finished.connect(self._start)
        self._sig_download_finished.connect(worker.sig_download_finished)
        self._sig_download_progress.connect(worker.sig_download_progress)
        worker.sig_finished.connect(thread.quit)
        thread.started.connect(worker.start)
        self._queue.append(thread)
        self._threads.append(thread)
        self._workers.append(worker)
        self._start()
        return worker
1073116
def multi_process_pynac(file_list, pynac_func, num_iters=100, max_workers=8):
    
    with ProcessPoolExecutor(max_workers=max_workers) as executor:
        tasks = [executor.submit(do_single_dynac_process, num, file_list, pynac_func) for num in range(num_iters)]
    exc = [task.exception() for task in tasks if task.exception()]
    if exc:
        return exc
    else:
        return "No errors encountered"
519106
private void startWorkers(final ExecutorService executorService, final int numTasks) {
        for (int i = 0; i < numTasks; i++) {
            workerFutures.add(executorService.submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    runWorkLoop();
                    return null;
                }
            }));
        }
    }
1063990
private void addWorker() {
        Throwable ex = null;
        ForkJoinWorkerThread wt = null;
        try {
            if ((wt = factory.newThread(this)) != null) {
                wt.start();
                return;
            }
        } catch (Throwable e) {
            ex = e;
        }
        deregisterWorker(wt, ex); // adjust counts etc on failure
    }
948546
function DaisyChain(workers, concurrency) {
  var self = this
      , queues = this.queues = new Array(workers.length);

  // create queues and inject unidirectional linked list marker.
  var last;
  for (var i = 0; i < workers.length; i++) {
    var queue = queues[i] = async.queue(workers[i], concurrency);
    last = queue;
  }

  // add hooks for empty and drain
  last.empty = function() {
    if (self.empty) {
      async.all(queues, function(q, cb){ cb(q.length() === 0); }, function(yes) { if (yes) self.empty(); });
    }
  }

  last.drain = function() {
    if (self.drain) {
      async.every(queues, function(q, cb){ cb((q.length()+q.running()) === 0); }, function(yes) { if (yes) self.drain(); });
    }
  }
}
412004
def multithreader(args, paths):
    """"""

    def shellprocess(path):
        """Return a ready-to-use subprocess."""
        import subprocess
        return subprocess.Popen(args + [path],
                                stderr=subprocess.DEVNULL,
                                stdout=subprocess.DEVNULL)

    processes = [shellprocess(path) for path in paths]

    for process in processes:
        process.wait()
1251291
private void startWorkers() {
        m_logger.info("Starting {} workers", m_config.workers);
        for (int workerNo = 1; workerNo <= m_config.workers; workerNo++) {
            LoadWorker loadWorker = new LoadWorker(workerNo);
            loadWorker.start();
            m_workerList.add(loadWorker);
        }
    }
828814
def processes(self):
        """"""
        if self._processes is None:
            self._processes = []
            for p in range(self.workers):
                t = Task(self._target, self._args, self._kwargs)
                t.name = "%s-%d" % (self.target_name, p)
                self._processes.append(t)

        return self._processes
1094901
def worker(self, sock):
        
        setproctitle('oq-zworker')
        with sock:
            for cmd, args, mon in sock:
                parallel.safely_call(cmd, args, mon)
943366
private void doWakeUpWorker() {
        if (idleWorkers.get() == 0) {
            synchronized (workers) {
            	if (workers.size() >= getMaximumPoolSize()) {
                    return;
                }
                if (workers.isEmpty() || (idleWorkers.get() == 0)) {
                	addWorkerUnsafe();
                }
            }
        }
    }
873281
def worker_process(params, channel):
    """"""
    signal(SIGINT, SIG_IGN)

    if params.initializer is not None:
        if not run_initializer(params.initializer, params.initargs):
            os._exit(1)

    try:
        for task in worker_get_next_task(channel, params.max_tasks):
            payload = task.payload
            result = process_execute(
                payload.function, *payload.args, **payload.kwargs)
            send_result(channel, Result(task.id, result))
    except (EnvironmentError, OSError, RuntimeError) as error:
        os._exit(error.errno if error.errno else 1)
    except EOFError:
        os._exit(0)
243374
def _start_new_worker_process(self, server_socket):
        """"""
        from multiprocessing import Process
        p = Process(target=forked_child, args=self._get_child_args(server_socket))
        p.start()
        return p
294775
def new_parallel(self, function, *params):
        '''
        
        '''
        # Create a pool if not created (processes or Gevent...)
        if self.ppool is None:
            if core_type == 'thread':
                from multiprocessing.pool import ThreadPool
                self.ppool = ThreadPool(500)
            else:
                from gevent.pool import Pool
                self.ppool = Pool(500)
        # Add the new task to the pool
        self.ppool.apply_async(function, *params)
599696
def start_workers(self):
        """"""

        if self._started:
            raise InternalError("The method start() was called twice on a BaseRunnable object.")

        self._started = True

        for worker in self._workers:
            worker.start()
567015
private synchronized Worker createWorker(int i) throws IOException {
    Preconditions.checkState(mState == State.STARTED,
        "Must be in a started state to create workers");
    File confDir = new File(mWorkDir, "conf-worker" + i);
    File logsDir = new File(mWorkDir, "logs-worker" + i);
    File ramdisk = new File(mWorkDir, "ramdisk" + i);
    logsDir.mkdirs();
    ramdisk.mkdirs();
    int rpcPort = getNewPort();
    int dataPort = getNewPort();
    int webPort = getNewPort();

    Map<PropertyKey, String> conf = new HashMap<>();
    conf.put(PropertyKey.LOGGER_TYPE, "WORKER_LOGGER");
    conf.put(PropertyKey.CONF_DIR, confDir.getAbsolutePath());
    conf.put(PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(0),
        ramdisk.getAbsolutePath());
    conf.put(PropertyKey.LOGS_DIR, logsDir.getAbsolutePath());
    conf.put(PropertyKey.WORKER_RPC_PORT, Integer.toString(rpcPort));
    conf.put(PropertyKey.WORKER_WEB_PORT, Integer.toString(webPort));

    Worker worker = mCloser.register(new Worker(logsDir, conf));
    mWorkers.add(worker);
    LOG.info("Created worker with (rpc, data, web) ports ({}, {}, {})", rpcPort, dataPort,
        webPort);
    return worker;
  }