StackPractices

concurrency

Practical resources about concurrency for software engineers.

37 results

Managing Parallel Execution

Modern hardware is parallel, but writing correct concurrent code remains one of the hardest problems in software engineering. Race conditions, deadlocks, and thread starvation can cause bugs that only appear under production load.

This collection covers async patterns, thread pools, locks and mutexes, concurrent data structures, and message-passing models like CSP. Each pattern includes common pitfalls and language-specific implementation advice.

advanced

Actor Model Pattern: Concurrency Without Shared State

Isolate state in actors that communicate only via messages. Each actor processes one message at a...

intermediate

Async Generator Pattern for Lazy Streaming

Stream data lazily with async generators. Yield values one at a time as they become available,...

intermediate

Distributed Lock Pattern with Redis, ZooKeeper, and etcd

Coordinate exclusive access to shared resources across distributed nodes using Redis, ZooKeeper, or...

advanced

Lock-Free Queue Pattern

Build high-throughput queues using atomic operations instead of locks. Multiple threads can enqueue...

intermediate

Priority Queue Pattern: Schedule Tasks by Urgency

Use the Priority Queue pattern to process high-priority work first. See Python, Java, and...

intermediate

Producer-Consumer Pattern

Decouple production and consumption with a shared queue. Producers generate items at their own...

advanced

Reactive Streams Pattern

Process asynchronous data streams with backpressure. Subscribers request N items at a time,...

intermediate

Thread Pool Pattern

Reuse a fixed set of threads for short-lived tasks instead of creating a new thread per task....

intermediate

Bulkhead Pattern: Isolate Resources to Limit Blast Radius

Isolate resources per service to limit blast radius. Covers thread pool isolation, connection pool...

advanced

Async Task Cancellation Runbook — Python, JS, Go, Java

Runbook for cancelling long-running async tasks without leaks: cooperative signals, cleanup...

async cancellation concurrency timeout
advanced

Race Condition Debugging Checklist

Checklist for identifying and fixing race conditions in concurrent code: symptom identification,...

intermediate

Thread Pool Sizing Template

Template for documenting thread pool configuration per service: pool type selection, sizing...

advanced

Complete Guide to Go Concurrency

Go concurrency in production: goroutines, channels, context, sync, worker pools, pipelines, rate...

advanced

Complete Guide to Java Concurrency

Java concurrency in production: threads, locks, CompletableFuture, virtual threads, executors,...

advanced

Complete Guide to Python Asyncio

Master asynchronous Python programming with asyncio. Covers coroutines, tasks, event loops,...

advanced

Complete Guide to Python Asyncio in Production

Run asyncio in production: event loops, TaskGroup, cancellation, backpressure, debugging, and async...

advanced

Concurrency Patterns Guide

Production-ready concurrency patterns: thread pools, async/await, producer-consumer, semaphores,...

No results found.