Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run multiple Python jobs in parallel, submit each job to a concurrent.futures executor, keep its Future paired with a stable job ID, and collect each result or exception in the controlling thread. Start with a thread pool for blocking I/O or try a process pool for suitable CPU-bound work; neither choice guarantees a speedup without testing your actual workload.

Define what the job runner promises

A small runner needs more than a pool of workers. Before choosing an executor, decide what callers submit and what they get back. Give every job a stable ID, a callable, and its arguments. Also decide whether results are reported in submission order or as jobs finish, what happens when one job fails, and how the caller closes the runner.

  • Identity: keep a job ID or input associated with every submitted job.
  • Result order: choose input order for predictable batch output, or completion order when prompt reporting matters.
  • Failure policy: decide whether to continue collecting independent jobs, stop reporting after a failure, or return an aggregate of successes and failures.
  • Shutdown: make clear when the caller waits for outstanding work to finish.

Prefer having the controlling thread gather results rather than having workers mutate a shared result collection. That keeps the boundary between executing a job and recording its outcome simple.

Start with the standard-library executor and Future

Python’s concurrent.futures API provides a shared Executor interface. Calling submit(fn, *args, **kwargs) schedules a callable and immediately returns a Future: an object that represents the work, which may complete later. The abstract Executor is not itself a pool; concrete implementations such as ThreadPoolExecutor and ProcessPoolExecutor provide the execution backend.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Store the association between each future and its job ID so a result can be identified even when jobs finish out of order:

from concurrent.futures import ThreadPoolExecutor, as_completed


def run_job(value):
    return value * 2


jobs = [("job-a", 10), ("job-b", 20), ("job-c", 30)]

with ThreadPoolExecutor() as executor:
    future_to_job_id = {
        executor.submit(run_job, value): job_id
        for job_id, value in jobs
    }

    for future in as_completed(future_to_job_id):
        job_id = future_to_job_id[future]
        try:
            result = future.result()
        except Exception as exc:
            print(job_id, "failed:", exc)
        else:
            print(job_id, "succeeded:", result)

This first version reports jobs in completion order. as_completed() yields each future as it finishes, and future.result() returns the callable’s value or raises the exception the callable raised. Catching Exception around an individual result lets the loop continue to collect other independent jobs; remove that recovery behavior or implement a different policy if a job failure should stop the batch.

Choose result order deliberately

The collection method is part of the runner’s observable behavior, not just an implementation detail.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Completion order with as_completed()

Use the future-to-ID mapping and as_completed() when consumers should hear about fast jobs without waiting for slower earlier submissions. Because completion order differs from submission order, the mapping is essential for associating each outcome with its job.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Input order with map()

Executor.map() yields results corresponding to input order, even if later jobs finish first. It can make ordered batch processing concise, but a slow early job can delay access to later completed results. A task exception is raised when its corresponding result is retrieved. In Python 3.13, map() collects its input iterables immediately, so it is not a safe assumption for an arbitrarily large or unbounded input stream.

How do I choose between ThreadPoolExecutor and ProcessPoolExecutor?

Choose a first backend based on the workload and programming style, then measure with representative jobs on the target Python version and hardware. The Python concurrency overview describes the relevant choice as depending on whether work is CPU- or I/O-bound and on whether the preferred style is event-driven cooperative multitasking or preemptive multitasking (Python concurrency overview). That is a decision framework, not a promise that one executor will be faster for every application.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Option Good first fit Important trade-off
ThreadPoolExecutor Synchronous callables that spend substantial time waiting on blocking I/O. Threads run in the same process. Test the real workload rather than assuming a thread pool improves CPU-bound Python computation.
ProcessPoolExecutor CPU-bound work where running jobs in separate processes is appropriate. Worker functions and transferred arguments must be picklable, and the worker process must be able to import the main module.
asyncio Applications structured around event-driven coroutine code. It is a different concurrency model, not a drop-in executor choice for ordinary synchronous callables.

The executors share the submit/Future interface, so changing the backend can be a small code change. The operating model is still different: process pools cross a process boundary and impose serialization and importability requirements, while threads remain within one process. No general worker count or numerical speedup follows from the API choice alone.

Bound the number of submitted jobs when input is large

A runner that submits every item from a very large source at once may consume substantial memory and create a large backlog. In Python 3.13, Executor.map() eagerly collects its iterables. For a finite but large or streaming source, keep only a limited number of futures in flight, then submit another job as one completes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

One basic pattern is to maintain a set of pending futures and replenish it after each completion. The maximum should be an explicit application choice based on the work, memory budget, and acceptable queueing; the documentation does not establish a universal value.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
from concurrent.futures import ThreadPoolExecutor, wait, FIRST_COMPLETED


def run_bounded(executor, jobs, limit):
    jobs = iter(jobs)
    pending = {}

    def fill():
        while len(pending) < limit:
            try:
                job_id, value = next(jobs)
            except StopIteration:
                return
            future = executor.submit(run_job, value)
            pending[future] = job_id

    fill()
    while pending:
        done, _ = wait(pending, return_when=FIRST_COMPLETED)
        for future in done:
            job_id = pending.pop(future)
            try:
                yield job_id, future.result(), None
            except Exception as exc:
                yield job_id, None, exc
        fill()

Here each yielded tuple contains a job ID, either a result or None, and either an exception or None. If None is a legitimate result or failure representation in your application, use a distinct result type instead. Call it inside the executor’s context manager so pending work is still governed by the runner’s chosen shutdown behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Close the pool and understand cancellation

An executor context manager shuts down the pool on exit and waits for pending work to finish. This is convenient for a batch whose caller should not leave while submitted work remains outstanding:

with ThreadPoolExecutor() as executor:
    # submit jobs and collect outcomes
    ...
# The context manager waits for work to finish.

Cancellation does not forcibly stop a callable that is already running. Future.cancel() succeeds only before execution begins. Likewise, shutdown(cancel_futures=True) cancels futures that have not started, but does not cancel running calls. Choose shutdown behavior with that distinction in mind; if jobs need cooperative stopping, the job code needs its own cancellation mechanism.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Make a process-pool runner portable

Process pools require extra care compared with the thread-pool example. Keep worker functions at module scope, pass picklable arguments, and protect process-launching code in a portable script with the standard main guard:

from concurrent.futures import ProcessPoolExecutor


def cpu_job(value):
    return value * value


def main():
    with ProcessPoolExecutor() as executor:
        print(list(executor.map(cpu_job, [2, 3, 4])))


if __name__ == "__main__":
    main()
  • The worker callable and values sent to it must be picklable.
  • The subprocess must be able to import the main module.
  • Do not call executor or future methods from a callable running in a process pool; doing so can deadlock.

The Python 3.13 documentation notes that the multiprocessing default start method changes away from fork in Python 3.14. If an application depends on fork, request the appropriate multiprocessing context explicitly rather than relying on the default. Verify version-specific behavior against the Python version the application actually runs.

Where this runner stops being the right abstraction

This design handles local concurrent execution: submit work, identify it, collect outcomes, and close the pool. It does not provide a persistent queue, durable retries, scheduling, or distributed orchestration. If jobs must survive process or machine restarts, run across multiple hosts, or be scheduled independently of a calling process, those are separate system requirements rather than features of this small executor-based runner.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.