<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mugendi Denis on Medium]]></title>
        <description><![CDATA[Stories by Mugendi Denis on Medium]]></description>
        <link>https://medium.com/@mawishtom?source=rss-82e354786d8f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lp3Z8k5XIfw6SpOK</url>
            <title>Stories by Mugendi Denis on Medium</title>
            <link>https://medium.com/@mawishtom?source=rss-82e354786d8f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:12:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mawishtom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Nobody Told You asyncio Has a 40-Year Origin Story. Here It Is.]]></title>
            <link>https://medium.com/@mawishtom/nobody-told-you-asyncio-has-a-40-year-origin-story-here-it-is-4cf1e5ddcada?source=rss-82e354786d8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cf1e5ddcada</guid>
            <category><![CDATA[asyncio]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Mugendi Denis]]></dc:creator>
            <pubDate>Thu, 11 Jun 2026 20:23:12 GMT</pubDate>
            <atom:updated>2026-06-11T20:23:12.279Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Python · asyncio · Linux · Concurrency · Software Engineering · Programming History · Backend Development · Open Source</em></p><p>Everyone learns <em>how</em> to use asyncio. Nobody learns <em>why</em> it exists.</p><p>That’s a mistake.</p><p>Because asyncio didn’t appear from thin air in Python 3.4. It’s the final answer to a question engineers have been asking since 1983.</p><p>Here’s the full story. No textbooks. No documentation. Just the history they never put in the tutorial.</p><h3>1983. A Problem Nobody Had Solved Yet.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oeo5JKu6DRdiA8Mq5ta0Ew.png" /></figure><p><em>The Unix family tree — asyncio’s story starts in BSD Unix 1983</em></p><p>The internet is young. Networking is new. And developers hit a wall.</p><p>A program can only do one thing at a time. If it’s waiting for data from a network socket — it waits. It can’t check another socket. It can’t do anything else. It just blocks.</p><p>For a single client, that’s fine. For a server handling many clients at once? Disaster.</p><p>The solution that came out of BSD Unix in 1983 was a system call called select.</p><p>It let a program hand a list of sockets to the OS and say: <em>“Tell me which ones have data ready.”</em></p><p>If none do — the program waits. But only until one of them is ready. Then it handles that one. Then checks again.</p><p>That loop — waiting for events, handling them one by one — is called an <strong>event loop</strong>.</p><blockquote><em>You’re still using the same idea today, every time you write </em><em>async def. The event loop is 40 years old.</em></blockquote><h3>Mid-1990s. Someone Builds a Framework.</h3><p>Writing an event loop from scratch every time is painful. Same bugs. Same patterns. Same problems solved over and over.</p><p>Sam Rushing thought: <em>why not package this once?</em></p><p>He built <strong>Medusa</strong> — the first event-driven async networking framework for Python. It powered the early Google web crawler. It powered Yahoo’s SMTP engine. It powered the Zope web server.</p><p>Sam then carved out the core pieces into a standalone library called asyncore.</p><p>Guido van Rossum liked it so much he shipped it in the Python standard library in 1999.</p><blockquote><em>It’s still there in Python 3.8. Deprecated, but there. You can open it right now and read code from 1999 doing the same thing FastAPI does today.</em></blockquote><h3>2000. Twisted Changes Everything. Sort Of.</h3><p>A team starts the <strong>Twisted</strong> project.</p><p>Different spin on the event loop idea. Organized around callbacks — they called them <em>deferreds</em>.</p><p>The timing matters here. This was before PEP 8. Before nested scopes. Before unittest existed in Python. The language was young and rough.</p><p>And yet Twisted gathered a massive following. Apple used it for calendar servers. Google used it for DNS clients. Facebook used it for load balancing.</p><p>But Twisted had a problem.</p><p>Everything had to be non-blocking. Every single API. If you wanted to use a regular Python library with Twisted — one that made a blocking call — you were on your own.</p><p>The rest of the Python ecosystem kept writing blocking code. Twisted and the world grew apart.</p><blockquote><em>“A great async framework is useless if it doesn’t play with everything else.”</em></blockquote><h3>Early 2000s. The Wildest Idea Anyone Had.</h3><p>Christian Tismer started <strong>Stackless Python</strong>.</p><p>The idea: run <em>thousands</em> of micro-threads — called green threads — all inside a single OS thread. No GIL problems. Cooperative multitasking. General computation, not just networking.</p><p>But the wildest part?</p><p>You could <strong>pickle a running green thread</strong>.</p><p>Save the entire state of an executing thread to a database. Retrieve it later. Resume it like nothing happened.</p><p>One company took this idea to its logical extreme: <strong>CCP</strong>, the Icelandic game company behind EVE Online.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xqEmDxYyNPKKy7rUBhR6g.jpeg" /></figure><p><em>EVE Online — millions of green threads modelling a living, real-time universe</em></p><p>EVE Online runs a single-shard universe. Thousands of players. Millions of real-time events. Space battles. Market trades. All of it modelled simultaneously using green threads in massive numbers.</p><p>Stackless Python was never merged into CPython. It needed hand-written assembly code. It broke most C extensions. Guido had to say no.</p><p>But the ideas didn’t die.</p><h3>~2009. Two More Attempts.</h3><p>The green threads from Stackless Python lived on in a library called <strong>greenlet</strong>. Someone combined it with a C-based event loop and built <strong>GEvent</strong>.</p><p>The pitch was seductive: write regular synchronous Python. GEvent monkey-patches the blocking parts into non-blocking ones behind the scenes.</p><p>Async that looked like sync. No callbacks. No special syntax.</p><p>It worked — until it didn’t. One long blocking call could silently slow the entire application. The monkey-patching clashed with third-party libraries. Debugging was a nightmare.</p><p>GEvent is still maintained today. The <strong>gunicorn</strong> HTTP server started as a GEvent project. But it never made it to the mainstream.</p><p>That same year, Facebook open-sourced <strong>Tornado</strong> as part of their FriendFeed acquisition.</p><p>Tornado introduced cooperative multitasking through careful subclassing and special decorators. Better than callbacks. Still nothing like what we have today. But Tornado is still actively maintained and works natively with async/await.</p><h3>2014. The One That Sticks.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*o2Tbv_7qIZ4BiFdsBffLlw.png" /></figure><p><em>The asyncio event loop — one thread, many tasks, no waiting wasted</em></p><p>Guido van Rossum takes the wheel.</p><p>He rewrites the async I/O proposal — which had been stalled for years — and ships <strong>asyncio</strong> in Python 3.4.</p><p>He didn’t do it alone. Glyph from the Twisted project helped. Ben Darnell from Tornado helped. Yury Selivanov from the team that would later build EdgeDB helped.</p><p>The result: an async framework built into Python itself. No third-party dependency. Coroutines via yield from. A real event loop. Batteries included from day one.</p><blockquote><em>A Facebook team used it in production on day one — an app orchestrating cache invalidations across MySQL databases. Ran for two and a half years on the very first version.</em></blockquote><h3>2015. Finally, Clean Syntax.</h3><p>Using yield from for coroutines was powerful but error-prone.</p><p>Forget a decorator — broken. Write yield instead of yield from — broken. Miss the yield from entirely — broken silently.</p><p>Yury Selivanov wrote PEP 492, inspired by C#’s async model. It introduced two new keywords: async and await.</p><pre># Before PEP 492 — error-prone, confusing<br>@asyncio.coroutine<br>def fetch_data():<br>    result = yield from database.query(&quot;SELECT * FROM users&quot;)<br>    return result</pre><pre># After PEP 492 — clean, readable, unambiguous<br>async def fetch_data():<br>    result = await database.query(&quot;SELECT * FROM users&quot;)<br>    return result</pre><p>Coroutines became first-class language constructs. No more generator confusion. No more magic decorators.</p><p>The language didn’t just support async. It <em>understood</em> async.</p><h3>2016+. The Rethink.</h3><p>David Beazley — an experienced Python educator — asked a hard question:</p><p><em>If we built asyncio from scratch today, knowing everything we know, what would it look like?</em></p><p>He built <strong>curio</strong> to answer that.</p><p>Nathaniel J. Smith went further with <strong>trio</strong> — focused entirely on usability and correctness.</p><p>Trio’s biggest innovation: <strong>nurseries</strong> (now called task groups). The idea: a task shouldn’t be able to escape its parent scope. Every task you create must be accounted for. No orphaned background work. No silent failures.</p><p>Task groups landed in Python 3.11 via asyncio.TaskGroup.</p><blockquote><em>The rethink changed the thing it was rethinking.</em></blockquote><h3>Today.</h3><p>FastAPI. Starlette. aiohttp. Async SQLAlchemy. Async Redis.</p><p>The async Python ecosystem is now mature. You can build production APIs, real-time systems, data pipelines — all async, all native, all readable.</p><p>It took 40 years. 1983 to 2023. From a C system call in BSD Unix to async def in Python.</p><p>Every layer — Medusa, Twisted, Stackless, GEvent, Tornado, asyncio — was one more answer to the same question:</p><p><em>How do we stop wasting time waiting?</em></p><p>Now you know where the answer came from.</p><p><em>Next up → </em><strong><em>Part 2: The Event Loop</em></strong><em> — what it actually is and how it runs your async code under the hood.</em></p><p><strong>Tags:</strong> Python asyncio Linux Concurrency Software Engineering Programming Python3 History of Computing Backend Development Open Source</p><p><em>If this helped you understand asyncio, clap 👏 and follow for the rest of the series — one post per week.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cf1e5ddcada" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>