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.

Ntsc-rs – open-source video emulation of analog TV and VHS artifacts

https://ntsc.rs/
130•gregsadetsky•2h ago•26 comments

Universal Memory Protocol – a shared format for agent memory

https://universalmemoryprotocol.io/
20•edihasaj•58m ago•8 comments

Home alone: Remote work, isolation, and mental health

https://www.science.org/doi/10.1126/science.aec7671
36•speckx•1h ago•12 comments

Meta confirms 1000s of Instagram accounts were hacked by abusing its AI chatbot

https://this.weekinsecurity.com/meta-confirms-thousands-of-instagram-accounts-were-hacked-by-abus...
188•speckx•3h ago•70 comments

Zeroserve: A zero-config web server you can script with eBPF

https://su3.io/posts/introducing-zeroserve
146•losfair•6h ago•39 comments

Nvidia is proposing a beast of a CPU system for Windows PCs

https://twitter.com/lemire/status/2062880075117113739
186•tosh•8h ago•365 comments

You Can Run

https://magazine.atavist.com/2026/mccann-cocaine-fugitives
73•bryanrasmussen•5h ago•16 comments

Computex 2026: Are We Heading for the Agentic PC Era Yet? – EE Times

https://www.eetimes.com/computex-2026-are-we-heading-for-the-agentic-pc-era-yet/
9•rbanffy•1h ago•1 comments

Show HN: Infinite canvas notes in the non-Euclidean Poincaré disk

https://uonr.github.io/poincake/
85•uonr•4d ago•10 comments

Benchmarks in Leipzig

https://arxiv.org/abs/2606.05818
115•root-parent•7h ago•42 comments

How LLMs work

https://www.0xkato.xyz/how-llms-actually-work/
798•0xkato•3d ago•224 comments

Google will pay SpaceX $920M per month for compute

https://techcrunch.com/2026/06/05/google-will-pay-spacex-920m-per-month-for-compute/
374•ramanan•9h ago•539 comments

Pokemon Emerald Ported to WebAssembly (100k FPS)

https://pokeemerald.com/
223•tripplyons•10h ago•62 comments

PyTorch Custom Operation

https://leimao.github.io/blog/PyTorch-Custom-Operation/
7•eigenBasis•5d ago•0 comments

Pentagon raised threat of Israeli spying on U.S. to highest level, sources say

https://www.nbcnews.com/politics/national-security/pentagon-raised-threat-israeli-spying-us-highe...
257•MilnerRoute•3h ago•167 comments

WoofWare.PawPrint, a Deterministic .NET Runtime

https://www.patrickstevens.co.uk/posts/2026-06-04-announcing-woofware-pawprint/
35•Smaug123•2d ago•13 comments

Running Python code in a sandbox with MicroPython and WASM

https://simonwillison.net/2026/Jun/6/micropython-in-a-sandbox/
59•theanonymousone•7h ago•19 comments

Police in England and Wales told to halt AI use in court statements

https://www.ft.com/content/229e5949-3ebc-4151-8a86-a01b5e259241
131•nmstoker•6h ago•44 comments

Summer of '85: DOSBOS is rejected by ANALOG Computing

https://www.goto10retro.com/p/summer-of-85-dosbos-is-rejected-by
41•ibobev•2d ago•9 comments

S&P 500 rejects SpaceX, also blocking entry for OpenAI and Anthropic

https://arstechnica.com/tech-policy/2026/06/sp-500-blocks-fast-spacex-entry-wont-waive-rule-for-u...
1277•maltalex•16h ago•438 comments

Building Rust Procedural Macros from the Grounds Up

https://www.learnix-os.com/ch02-03-implementing-the-bitfields-proc-macro.html
67•Sagi21805•6d ago•15 comments

New method turns ocean water into drinking water, without waste

https://www.rochester.edu/newscenter/what-is-desalination-definition-ocean-water-704732/
489•speckx•1d ago•201 comments

Mbodi AI (YC P25) Is Hiring Founding Machine Learning Engineer (Robotics)

https://www.ycombinator.com/companies/mbodi-ai/jobs/WYAcNkX-founding-machine-learning-engineer
1•chitianhao•9h ago

Ask HN: Why is the HN crowd so anti-AI?

317•Ekami•19h ago•550 comments

Trees to Flows and Back: Unifying Decision Trees and Diffusion Models

https://arxiv.org/abs/2605.00414
33•rsn243•8h ago•7 comments

The intracies of modern camera lens repair (2024)

https://salvagedcircuitry.com/sigma-45mm.html
234•transistor-man•21h ago•83 comments

New U.S. college grads now have higher unemployment than the average worker

https://www.randalolson.com/2026/06/04/recent-grad-unemployment-flip/
14•davidbarker•1h ago•3 comments

Python JIT project was asked to pause development

https://discuss.python.org/t/an-announcement-from-the-steering-council-regarding-the-jit-project/...
123•kbumsik•6h ago•53 comments

Ask HN: What was your "oh shit" moment with GenAI?

512•andrehacker•1d ago•899 comments

Tribute to Jiro Yamada, Automotive Artist (1960-2025) [video]

https://www.youtube.com/watch?v=rJ2gQ5Md60U
36•NaOH•1d ago•3 comments