{"id":24468714,"url":"https://github.com/brianobot/learning_asyncio_in_python","last_synced_at":"2025-07-03T11:02:16.302Z","repository":{"id":192749242,"uuid":"687329917","full_name":"brianobot/learning_asyncio_in_python","owner":"brianobot","description":"Learning asyncio in Python","archived":false,"fork":false,"pushed_at":"2023-09-20T19:31:20.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-03T11:02:11.783Z","etag":null,"topics":["asynchronous-programming","asyncio","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianobot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-05T06:20:33.000Z","updated_at":"2023-12-13T16:05:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"38d25e34-c46d-4a12-b2c0-c718f7c6c44f","html_url":"https://github.com/brianobot/learning_asyncio_in_python","commit_stats":null,"previous_names":["brianobot/learning_asyncio_in_python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brianobot/learning_asyncio_in_python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Flearning_asyncio_in_python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Flearning_asyncio_in_python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Flearning_asyncio_in_python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Flearning_asyncio_in_python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianobot","download_url":"https://codeload.github.com/brianobot/learning_asyncio_in_python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Flearning_asyncio_in_python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263314092,"owners_count":23447289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous-programming","asyncio","python3"],"created_at":"2025-01-21T07:12:58.551Z","updated_at":"2025-07-03T11:02:16.249Z","avatar_url":"https://github.com/brianobot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# learning_asyncio_in_python\nLearning asyncio in Python By Brian Obot\n\nIf you are like me, and i trust many other people that have found themselves in the strange mental place\nof not really getting the full gists around the asyncio package or syntax in the python ecosystem, then maybe\nthis repository might help, or atleast stir more interest in your to dive more into the concept, \ni am documenting my learning here for reference and to help anyone that stumbles upon this repo. \n\nI Would point to useful materials that highlight the concepts needed for understanding this, i would try\nnot to duplicate ateraisl here, except neccesary...hope we are on the same page? .\n\u003cgives up control to a different section while waiting for the reader's response\u003e\n\n\n## Intro... \nSince i can't share the complete mail content here, below is a snippet of a mail from [Reuven M. Lerner](https://lerner.co.il/)\nSubscribe to his mails [Here](https://sparklp.co/a03dbf14/) \n```\nLet's start with some history and comparisons: Back in the olden days (even before I started to use computers),\na computer could only do one thing at a time. And indeed, if you had a home computer before the mid-1990s, then \nyour computer could *still* probably only do one thing at a time.\n\nIf you were on a home computer at the time, it wasn't necessarily obvious what you would want to happen while \nyou were working on your word processor, for example.  But if you had a mainframe (or even a minicomputer) at \nyour disposal, it was clearly a waste of resources to have only one person using this enormous power at a given \ntime.\n\nSome very clever engineers figured out that you could do \"time sharing\" on a computer. What this meant was \nthat every n fractions of a second, the currently running program (which is, after all, just a bunch of\ninstructions and data) would be copied into another part of memory, and another program would be copied \ninto the running part.  n fractions of a second later, the currently running program would be switched out,\nand a third program would be switched in.\n\nIn this way, you could have a bunch of people using the same computer at the same time.  Well, they weren't\n*really* using it at the same time; the computer was actually only running one program at a time, servicing\none user. But the illusion was powerful enough that it worked pretty well.  By the time I started to use \nUnix systems in the late 1980s, this was standard stuff; even if you were only running text-based programs, \nyou could have several of them executing at a given time, each doing its own thing.\n\nThe way that such systems worked was known as \"pre-emptive multitasking.\"  Programs weren't asked if\nthey wanted to give up control and execution.  Rather, every so often the operating system would yank \ncontrol away from them.  With pretty rare exception, though, this worked pretty well; programs didn't \nhave to know that they were occasionally being put into the virtual equivalent of an induced coma and then \nrevived n fractions of a second later.  Correctly run programs would just keep going, blissfully unaware \nthat they had been suspended and restarted.\n\nThen home users wanted to have some of this power. We started to see the Mac \"System 7\" and Windows 95, \nboth of which offered some version of multitasking. But they didn't use pre-emptive multitasking.  Rather, \nthey used something known as \"cooperative multitasking.\"\n\nIn a cooperative multitasking environment, you still have separate processes, each running in its own \npiece of memory and with its own instructions.  And things are still swapped in and out of active memory.\n\nThe difference is that whereas in a pre-emptive multitasking environment, the operating system decides when \neach program's time slice is up, in a cooperative multitasking environment, the program itself says, \n\"OK, I'm willing to give up the CPU for now.\"\n\n```\n\nThis history and the introduction of these concepts here would serve to build the proper mindset towards mastering asyncio.\natleast that what i think, cause i am almost at the same level with you right now in terms of understanding what is going on here. \u003cpauses!\u003e\n\n## ... Picks up from the Question about being on the same page\nHopefully, there is some level of appreciation for the centrak idea now for you, there is some for me, from the research and reading i \nhave found out that the other approaches to handling many things at once in programming includes but is not limited to\nwriting [threaded programs](https://en.wikipedia.org/wiki/Thread_(computing)) or using [multi-processing](https://en.wikipedia.org/wiki/Multiprocessing) both of which have their pros and cons with threaded programs being notoriously tricky to write\nand multiprocessing program having the overhead of managing communication across process on a system. \n\n\n## ... This repo is structured in a way that seems naturally intuitive and curated for me\nthis is not to say if you somehow have prior knowledge of certain basic concepts you can't just jump around,\nbut in order to gain more from this, a proper flow would really help. \n\n\n## Contribution.\nI am but one Person, any intellectual addition whether in the form of correction or improvement to the content of this repo is\nwhole hearted welcome. Clone the report and make you updates, and then make a pull request to the master branch of the repo.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianobot%2Flearning_asyncio_in_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianobot%2Flearning_asyncio_in_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianobot%2Flearning_asyncio_in_python/lists"}