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•11mo ago

Comments

quentinp•11mo 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•11mo ago
Page didnt load for me.

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

Multiprocessing all the way!

emmelaich•11mo ago
(2021)

Good article!

punnerud•11mo 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•11mo 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•11mo ago
How does the GIL come into play here?
punnerud•11mo 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.

I bought Friendster for $30k – Here's what I'm doing with it

https://ca98am79.medium.com/i-bought-friendster-for-30k-heres-what-i-m-doing-with-it-d5e8ddb3991d
164•ca98am79•2h ago•69 comments

Fast16: High-precision software sabotage 5 years before Stuxnet

https://www.sentinelone.com/labs/fast16-mystery-shadowbrokers-reference-reveals-high-precision-so...
92•dd23•2h ago•32 comments

Sawe becomes first athlete to run a sub-two-hour marathon in a competitive race

https://www.bbc.com/sport/athletics/articles/crm1m7e0zwzo
153•berkeleyjunk•2h ago•102 comments

Butterflies are in decline across North America, a look at the Western Monarch

https://www.smithsonianmag.com/science-nature/butterflies-are-in-dramatic-decline-across-north-am...
69•1659447091•1h ago•18 comments

Show HN: AI memory with biological decay (52% recall)

https://github.com/sachitrafa/YourMemory
32•SachitRafa•2h ago•14 comments

Magic: The Gathering took me from N2 to Japanese fluency

https://www.tokyodev.com/articles/how-magic-the-gathering-took-me-from-n2-to-japanese-fluency
60•pwim•2d ago•18 comments

AI should elevate your thinking, not replace it

https://www.koshyjohn.com/blog/ai-should-elevate-your-thinking-not-replace-it/
194•koshyjohn•3h ago•159 comments

Two Athletes Break Sub-2-HR Marathon in Adizero Adios Pro Evo 3

https://news.adidas.com/running/two-adidas-athletes-sabastian-sawe-and-yomif-kejelcha-break-the-s...
19•canucker2016•2h ago•3 comments

SWE-bench Verified no longer measures frontier coding capabilities

https://openai.com/index/why-we-no-longer-evaluate-swe-bench-verified/
226•kmdupree•9h ago•133 comments

MoQ Boy

https://moq.dev/blog/moq-boy/
26•mmcclure•2h ago•1 comments

Running Bare-Metal Rust Alongside ESP-IDF on the ESP32-S3's Second Core

https://tingouw.com/blog/embedded/esp32/run_rust_on_app_core
14•MrBuddyCasino•2d ago•1 comments

XOXO Festival Archive

https://xoxofest.com/
25•surprisetalk•2d ago•1 comments

Clay PCB Tutorial

https://feministhackerspaces.cargo.site/Clay-PCB-Tutorial
182•j0r0b0•7h ago•114 comments

The Visible Zorker: Zork 1

https://eblong.com/infocom/visi/zork1/
81•PLenz•6h ago•13 comments

The 1944 Warsaw Uprising, in Color

https://www.barwypowstania.pl/
97•keiferski•3h ago•35 comments

Show HN: Free textbook on engineering thermodynamics

https://thermodynamicsbook.com/
89•2DcAf•7h ago•27 comments

An AI agent deleted our production database. The agent's confession is below

https://twitter.com/lifeof_jer/status/2048103471019434248
360•jeremyccrane•6h ago•499 comments

Statecharts: hierarchical state machines

https://statecharts.dev/
267•sph•13h ago•76 comments

Amateur armed with ChatGPT solves an Erdős problem

https://www.scientificamerican.com/article/amateur-armed-with-chatgpt-vibe-maths-a-60-year-old-pr...
730•pr337h4m•1d ago•509 comments

GoDaddy gave a domain to a stranger without any documentation

https://anchor.host/godaddy-gave-a-domain-to-a-stranger-without-any-documentation/
494•jamesponddotco•6h ago•190 comments

Show HN: Startup Equity Adventure Game

https://options-game-polymathrobotics.pythonanywhere.com/
4•iliabara•53m ago•2 comments

Box to Save Memory in Rust

https://dystroy.org/blog/box-to-save-memory/
11•emschwartz•3d ago•0 comments

Chernobyl Wildlife Forty Years On

https://www.bbc.com/future/article/20260424-chernobyl-wildlife-forty-years-on
16•reconnecting•3h ago•0 comments

Show HN: Tiao, A two-player turn-based board game

https://playtiao.com
9•trebeljahr•2h ago•0 comments

Orinoco: Young Generation Garbage Collection

https://v8.dev/blog/orinoco-parallel-scavenger
30•plow-tycoon•3d ago•4 comments

Dear friend, you have built a Kubernetes (2024)

https://www.macchaffee.com/blog/2024/you-have-built-a-kubernetes/
61•Wingy•2d ago•96 comments

Dillo Browser Release 3.3.0

https://dillo-browser.org/release/3.3.0/
136•rodarima•5h ago•22 comments

Asahi Linux Progress Linux 7.0

https://asahilinux.org/2026/04/progress-report-7-0/
580•elisaado•12h ago•268 comments

Show HN: Turning a Gaussian Splat into a videogame

https://blog.playcanvas.com/turning-a-gaussian-splat-into-a-videogame/
196•yak32•3d ago•47 comments

Why has there been so little progress on Alzheimer's disease?

https://freakonomics.com/podcast/why-has-there-been-so-little-progress-on-alzheimers-disease/
398•chiefalchemist•22h ago•274 comments