Artisanal Async Adventures
summary
Builds a small async network stack that actually runs: 100 lines of Python using Python 3.6 type hints, standard library sockets and select-based event loop. Implements coroutine-based tasks, an awaitable object for read/send intents, two wait rooms for read/write, and a run loop that moves tasks between queues. Demo with netcat shows multiple concurrent TCP clients work. Notes: works for IO-bound loads, not a CPU-bound solution, and uses no external frameworks.
AI-written summary · about
chapters (16)
- 0:00Introduction and motivation
- 1:03Building a minimal server
- 7:26Concurrency problem discovered
- 8:07Introducing async/await
- 10:56Understanding await protocol
- 12:03Implementing async I/O
- 16:23Task scheduling system
- 20:02Event loop with select
- 22:13Testing the implementation
- 27:09How async I/O works
- 27:30Homework and further exploration
- 29:08Q&A: CPU-bound vs I/O-bound
- 30:10Q&A: Scalability and exceptions
- 30:56Q&A: Single-threaded nature
- 31:52Q&A: Relation to async libraries
- 32:18Q&A: Python 2 and callbacks
related talks
29mWhat in the World is Asyncio?
31mA Really Gentle Introduction to Asyncio
57mFear and Awaiting in Async: A Savage Journey to the Heart of the Coroutine Dream
01h 21mTUTORIAL: Async Python, Good it is
30m"Asyncio by Example"
35mHow Do Python Coroutines Work?
20mIt's Critical: Concurrent programming as a sane programming model
56mLeveraging Async and Await in Modern Python
