Automation · Parallelism & Concurrency
Multiprocessing
Cheat sheet · https://pcornel.dk/topic.php?topic=5989
Answer
Multiprocessing runs work in separate processes on several CPU cores, such as Python multiprocessing, which avoids the GIL for CPU-heavy tasks at the cost of more memory and inter-process communication.
Remember
- Separate processes avoid Python's GIL.
- Each process uses more memory.
- Data passed between processes is pickled.
First checks
- ProcessPoolExecutor for CPU-bound work — parallelism
- Picklable arguments — compatibility
- Memory per process — resources
Verify in this order
tasks → process pool → results
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5989