frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

How async/await works in Python (2021)

https://tenthousandmeters.com/blog/python-behind-the-scenes-12-how-asyncawait-works-in-python/
61•sebg•1y ago

Comments

quentinp•1y ago
While it stays at the Python level, https://github.com/AndreLouisCaron/a-tale-of-event-loops really helped me to understand how asyncio and Trio are implemented. I had no idea how sleeps worked before reading that post.
incomingpain•1y ago
Page didnt load for me.

https://realpython.com/async-io-python/

Multiprocessing all the way!

emmelaich•1y ago
(2021)

Good article!

punnerud•1y ago
A more simplified version:

Synchronous code is like a single-lane road where cars (tasks) must travel one after another in perfect sequence. If one car stops for gas (waiting for I/O), every car behind it must stop too. While orderly and predictable, this creates massive traffic jams as tasks wait unnecessarily for others to complete before they can proceed.

Pure asynchronous code (with callbacks) is like dispatching multiple cars onto independent routes with no coordination. Cars move freely without waiting for each other, but they arrive at unpredictable times and following their progress becomes chaotic. It's efficient but creates a complex tangle of paths that becomes hard to maintain.

Async/await combines the best of both approaches with a multi-lane highway system. Cars follow clear, synchronous-looking routes (making code readable), but only wait at strategic "await" exit ramps when truly necessary. When a car needs data, it signals with "await", pulls off the highway temporarily, and other cars continue flowing past. Once its operation completes, it merges back into traffic and continues. This gives you the logical simplicity of synchronous code with the performance benefits of asynchronous execution - cars only wait at crossroads when they must, maximizing throughput while maintaining order.

The genius of async/await is that it lets developers write code that looks sequential while the runtime handles all the complex traffic management under the hood.

explodes•1y ago
Excellent write up. I appreciate the level of details here showing the history from the days of old, before async/await were even keywords.
bilsbie•1y ago
How does the GIL come into play here?
punnerud•1y ago
GIL is like a "red-cap" on the head for the CPU-core running the task, so you would not be able to run true Async without GIL. Have to hand the "red-cap" back, for the next task.

Instead of using a global lock ("red-cap"), Python objects have introduced a specialized reference counting system that distinguishes between "local" references (owned by a single thread) and "shared" references (accessed by multiple threads).

In that way enabling to remove GIL in the long run, now starting with making it optional.

On The <dl>

https://benmyers.dev/blog/on-the-dl/
146•ravenical•2h ago•47 comments

80386 Microcode Disassembled

https://www.reenigne.org/blog/80386-microcode-disassembled/
125•nand2mario•3h ago•21 comments

Oura says it gets government demands for user data. Will it share how many?

https://this.weekinsecurity.com/oura-says-it-gets-government-demands-for-user-data-will-it-share-...
50•donohoe•1h ago•22 comments

z386: An Open-Source 80386 Built Around Original Microcode

https://nand2mario.github.io/posts/2026/z386/
23•wicket•1h ago•2 comments

Making Deep Learning Go Brrrr from First Principles

https://horace.io/brrr_intro.html
74•tosh•4h ago•28 comments

PHP's Oddities

https://flowtwo.io/post/php%27s-oddities
9•thejoeflow•3d ago•2 comments

Highest Random Weight in Elixir

https://jola.dev/posts/highest-random-weight-in-elixir
21•shintoist•2d ago•0 comments

Lisp in Vim (2019)

https://susam.net/lisp-in-vim.html
6•whent•1h ago•3 comments

I Miss Terry Pratchett

https://www.mahl.me/blog/the-spell-that-wouldnt-leave/
200•gorgmah•3h ago•172 comments

The Art of Money Getting

https://kk.org/cooltools/book-freak-210-the-art-of-money-getting/
25•dxs•3h ago•4 comments

Solving the "Zork" Mystery

https://www.dpolakovic.space/blogs/zork-part2
27•dpola•3d ago•11 comments

Shipping a laptop to a refugee camp in Uganda

https://notesbylex.com/shipping-a-laptop-to-a-refugee-camp-in-uganda
595•lexandstuff•18h ago•208 comments

Rubish: A Unix shell written in pure Ruby

https://github.com/amatsuda/rubish
118•winebarrel•9h ago•70 comments

The FBI Wants 'Near Real-Time' Access to US License Plate Readers

https://www.wired.com/story/security-news-this-week-fbi-license-plate-reader-real-time-access/
46•Brajeshwar•2h ago•20 comments

Why Japanese companies do so many different things

https://davidoks.blog/p/why-japanese-companies-do-so-many
778•d0ks•1d ago•372 comments

Improving C# Memory Safety

https://devblogs.microsoft.com/dotnet/improving-csharp-memory-safety/
87•soheilpro•1d ago•13 comments

BambuStudio has been violating PrusaSlicer AGPL license since their fork

https://xcancel.com/josefprusa/status/2054602354851254330
295•Tomte•7h ago•107 comments

A 1955 Los Alamos computer experiment changed our understanding of chaos

https://www.lanl.gov/media/publications/1663/science-of-unpredictability
28•LAsteNERD•3d ago•3 comments

The quadratic sandwich

https://fedemagnani.github.io/math/2026/04/08/the-quadratic-sandwich.html
101•cpp_frog•3d ago•8 comments

Microsoft starts canceling Claude Code licenses

https://www.theverge.com/tech/930447/microsoft-claude-code-discontinued-notepad
390•robertkarl•22h ago•370 comments

US tech firms share Dutch regulator officials' names with Senate

https://www.dutchnews.nl/2026/05/us-tech-firms-share-dutch-regulator-officials-names-with-senate/
157•zqna•5h ago•113 comments

Project Glasswing: An Initial Update

https://www.anthropic.com/research/glasswing-initial-update
482•louiereederson•20h ago•290 comments

ArcBrush – Node-based 2D image editor

https://arcbrush.com/
53•NatKarmios•2d ago•15 comments

Fast Factorial Algorithms

http://www.luschny.de/math/factorial/FastFactorialFunctions.htm
29•nill0•3d ago•8 comments

Yeunjoo Choi from Igalia on Chromium

https://theconsensus.dev/p/2026/05/20/yeunjoo-choi-from-igalia-on-chromium.html
48•eatonphil•3d ago•10 comments

- -dangerously-skip-reading-code – olano.dev

https://olano.dev/blog/dangerously-skip/
21•fagnerbrack•6h ago•16 comments

CISA tries to contain data leak

https://krebsonsecurity.com/2026/05/lawmakers-demand-answers-as-cisa-tries-to-contain-data-leak/
240•speckx•23h ago•54 comments

Sleep research led to a new sleep apnea drug

https://temertymedicine.utoronto.ca/news/how-decades-sleep-research-led-new-sleep-apnea-drug
205•colinprince•17h ago•119 comments

Blood Pumping Mechanism of the Hoof (2020)

https://horses.extension.org/blood-pumping-mechanism-of-the-hoof/
105•thunderbong•3d ago•39 comments

Deno 2.8

https://deno.com/blog/v2.8
393•roflcopter69•1d ago•161 comments