concurrency
6 lessons tagged concurrency: free, quiz-checked micro-lessons.
Async Python and asyncio
Async Python from the bytecode up. Coroutines vs return values, how the event loop schedules tasks, when async beats threading or multiprocessing, structured concurrency with TaskGroup, and the cancellation rules that production backends live or die by.
Transactions, Isolation, and MVCC
Transactions are a promise. Learn the ACID guarantees, the exact anomalies each SQL isolation level prevents or allows, why two-phase locking blocks and MVCC does not, and how Postgres uses row versions plus a transaction ID visibility check to give you snapshot isolation without holding a single read lock.
Threads and Shared State
Threads look deceptively simple — create a few, share some memory, done. In practice, shared mutable state is a minefield: race conditions, non-deterministic output, and bugs that vanish under a debugger. This lesson dissects concurrency vs parallelism, why `count++` is three operations the CPU can interleave, Amdahl's law, and what a critical section actually means.
Memory Models, Atomics, and Lock-Free
The CPU and compiler silently reorder your code. Cache coherence does not mean coherent behavior. This lesson explains the happens-before relation, memory fences, C++ and Java atomic operations, compare-and-swap, and why `volatile` is not a synchronization primitive.
Locks and Synchronization
Mutexes, condition variables, semaphores, and reader-writer locks — the primitives that make concurrent code correct. Understand the four Coffman deadlock conditions, how lock ordering prevents them, and why contention turns a performance win into a bottleneck.
Async, Event Loops, and Futures
Threads are not the only model for concurrency. Learn how blocking vs non-blocking I/O works, how the event loop and reactor pattern scale to millions of connections, and how callbacks evolved into futures, promises, and async/await — plus where coroutines fit and when async loses to threads.
