concurrent.futures.ProcessPoolExecutor()
concurrent.futures.ProcessPoolExecutor() is a Python function in the Concurrent Module category. Creates a process pool for CPU-bound parallel execution. The syntax is concurrent.futures.ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=()). Returns: ProcessPoolExecutor object. A typical example: with ProcessPoolExecutor() as ex:
results = ex.map(cpu_intensive_func, data). A close sibling is concurrent.futures.ThreadPoolExecutor(), which creates a thread pool for executing callables asynchronously. A close sibling is Executor.submit(), which schedules a callable to be executed and returns a Future. A close sibling is Executor.map(), which maps a function across iterables in parallel (like built-in map). A close sibling is Future.result(), which returns the result of the callable when complete. Blocks if not yet done. More about this category: Thread/process pools — ThreadPoolExecutor, ProcessPoolExecutor, Future. Related Concurrent Module entries: concurrent.futures.ThreadPoolExecutor(), Executor.submit(), Executor.map(), Future.result(), Future.done(), Future.cancel(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.