Python: Synchornization

All synchronization primitives are available from threading and multiprocessing modules. A primitive from threading module synchronizes between threads from the same process. A primitive from multiprocessing module synchronizes between threads across multiples processes and is heavier.

Primitives:

  1. Lock
  2. RLock (Reentrant or recursive lock)
  3. Semaphore
  4. BoundedSemaphore (raises ValueError if more releases than acquires)
  5. Event
  6. Condition (Event + Lock)
  7. Barrier

Leave a comment