Skip to content

01PrathamS/concurrency-chaos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

concurrency-chaos

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

redis_go

A Redis-like TCP echo server built in Go, evolving from sync to async.

Experiments

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

Run

cd redis_go
go run main.go
# optional flags
go run main.go -host 0.0.0.0 -port 7379

redis_py

The same sync server concept implemented in Python, with a test that proves the blocking behavior.

Experiments

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

Run

python redis_py/server/sync_tcp.py

See redis_py/readme.md for the full experiment walkthrough and manual PowerShell client instructions.


python_concurrency_from_scratch

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.

About

Experiments in concurrency — threads, async, queues, Redis, and event-driven systems, built from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors