Skip to main content Brad's PyNotes

Posts on Parallel

  1. Multiprocessing Module

    TL;DR

    The multiprocessing module creates separate Python processes that bypass the GIL, enabling true parallel execution for CPU-intensive tasks.

    Interesting!

    Unlike threading, multiprocessing actually uses multiple CPU cores simultaneously - each process has its own Python interpreter and memory space!

  2. Threading Module

    TL;DR

    The threading module enables concurrent execution through threads with synchronization primitives like Lock, Event, and Semaphore for safe resource sharing.

    Interesting!

    Python’s Global Interpreter Lock (GIL) means only one thread executes Python code at once - threading helps with I/O-bound tasks, not CPU-bound ones!