Browse by Topic

Popular

Latest

Latest Python Posts

Illustration of Python RLock allowing reentrant acquisition by the same thread, preventing deadlock.
Python

Python RLock: Reentrant Locking Explained

Learn how Python's RLock lets the same thread acquire a lock multiple times, preventing deadlocks in recursive and nested code. Includes examples and tradeoffs.

RLockthreadingconcurrencysynchronization
Illustration of a Python lock being acquired and released to synchronize threads
Python

Python Lock Acquire Release: Using Locks Correctly

Learn how to correctly acquire and release Python locks using threading.Lock, context managers, and related synchronization patterns to avoid race conditions.

threadingconcurrencysynchronizationlocks
Illustration of a Python threading lock protecting shared data between two concurrent threads
Python

Python Threading Lock: Usage and Common Pitfalls

Learn how to use threading.Lock in Python to protect shared state, avoid deadlocks, and choose between Lock, RLock, and higher-level synchronization primitives.

threadingconcurrencysynchronizationdeadlock
Illustration of a Python daemon thread running in the background while the main program exits without waiting for it.
Python

Python Daemon Thread: Behavior, Use Cases, and Pitfalls

python daemon thread: Learn how Python daemon threads behave at interpreter exit, when to use them for background work, and the pitfalls of abrupt termination.

threadingdaemon threadsconcurrencybackground tasks
Illustration of a Python thread join operation where one thread waits for another to complete before continuing.
Python

Python Thread Join: How to Wait for Threads

Learn how Python's `Thread.join()` blocks the calling thread until a target thread completes, with practical examples, timeout handling, and common pitfalls.

threadingconcurrencysynchronizationmultithreading
A visual representation of starting a thread in Python, showing a thread object and its start method.
Python

How to Start a Thread in Python with threading.Thread

Learn how to start a thread in Python with threading.Thread: call start(), pass arguments, manage daemon threads, join, and understand how the GIL affects performance.

threadingconcurrencypythonGIL
Illustration of a Python threading.Thread target callable being passed into a new thread for execution.
Python

Python Thread target: Passing the Right Callable

Learn how threading.Thread target works: pass the callable itself, provide args and kwargs correctly, handle uncaught thread exceptions, and understand daemon shutdown.

threadingThreadcallableconcurrency
Illustration of multiple Python threads running concurrently, each represented by a separate execution flow, with a lock icon symbolizing thread safety.
Python

How to Create and Manage Threads in Python

Learn how to create and coordinate threads in Python with threading.Thread: passing arguments, daemon threads, locks, exception handling, and using ThreadPoolExecutor when you need a bounded pool of workers.

ThreadingConcurrencyGILThread Safety
Illustration of multiple Python threads coordinating with locks and a queue, representing concurrency.
Python

Using the Python Threading Module for Concurrency

Learn how to create and manage threads with the Python threading module, including synchronization with locks, events, and conditions, thread pools, the GIL's impact, and common pitfalls.

threadingconcurrencyGILsynchronization
Illustration of multiple Python threads coordinating around a shared resource with a lock.
Python

Python Threads: Concurrency and Synchronization

Understand how to create and manage Python threads, synchronize access to shared data, and work effectively around the GIL.

threadingconcurrencyGILsynchronization