Designing and rewriting asynchronous tasks from scratch
summary
Reimplements the Task/future and TaskCompletionSource/promise from first principles, building a continuation queue, four continuation types, a thread‑pool future scheduler and a tryExecuteInline inlining heuristic, then implements the C# async state machine and a generic IAsyncMethodBuilder so async/await compiles to these primitives. Digs into a surprising boxing bug, forces a lazy allocation fix, shows allocator and delegate tradeoffs, and produces a working async/await pipeline that reduces heap allocations.
AI-written summary · about
chapters (15)
- 0:00Start
- 9:09Future Continuation
- 12:43Add Continuation
- 16:56Inlining
- 17:59Thread Pull Feature Scheduler
- 20:52Default Scheduler
- 25:39Async Await
- 26:32State Machine
- 32:18Working State Machine
- 35:39Nasync Method Builder
- 44:23Force the Allocation of the Future
- 45:17Implement the Fix
- 51:35The Async Method Builder Attribute
- 53:41The Circulation Context
- 57:43Extension Method
related talks
20mIt's Critical: Concurrent programming as a sane programming model
57mFear and Awaiting in Async: A Savage Journey to the Heart of the Coroutine Dream
33mArtisanal Async Adventures
30m"Asyncio by Example"
31mA Really Gentle Introduction to Asyncio
29mLet's make a working implementation of async functions in Python 2.1, also, why you might want to us
32mEnhancing AsyncIO for Complex Applications
29mMake a working implementation of async functions in Python 2.1
