Learning concurrency from first principles — by breaking things, observing the pain, and fixing it step by step.
Two tracks run in parallel:
| Track | What it covers |
|---|---|
python_concurrency_from_scratch/ |
Concurrency concepts in Python layer by layer |
redis_go/ + redis_py/ |
Building a Redis-like TCP server in Go and Python |
A Redis-like TCP echo server built in Go, evolving from sync to async.
| File | Description |
|---|---|
server/sync_tcp.go |
Single-threaded: one client at a time, blocks on each connection |
server/sync_tcp_v2.go |
Cleaned-up sync version with better logging |
server/async_tcp.go |
Async: each client gets its own goroutine, handles many clients concurrently |
cd redis_go
go run main.go
# optional flags
go run main.go -host 0.0.0.0 -port 7379The same sync server concept implemented in Python, with a test that proves the blocking behavior.
| File | Description |
|---|---|
server/sync_tcp.py |
Single-threaded sync echo server |
server/test_two_clients.py |
Spawns two clients concurrently to demonstrate Client-2 being blocked until Client-1 disconnects |
python redis_py/server/sync_tcp.pySee redis_py/readme.md for the full experiment walkthrough and manual PowerShell client instructions.
Bottom-up Python concurrency curriculum, each layer building on the last.
| Layer | Topic |
|---|---|
| Layer 1 | How code runs — call stack, CPU-bound work, blocking |
| Layer 2 | I/O and waiting — syscalls, file I/O, sequential HTTP |
| Layer 3 | Functions and callbacks — closures, higher-order functions |
| Layer 4 | Threading — interleaving, race conditions, locks |
| Layer 5 | Queues — producers/consumers, backpressure |
| Layer 6 | Async/await — event loop, asyncio.gather, blocking pitfalls |
| Layer 7 | Multiprocessing — separate memory, CPU-bound parallelism |
Each layer has a Docs/ write-up and runnable scripts.