frontpage.
newsnewestaskshowjobs

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.

Japan develops a method to recover up to 90% of lithium from used EV batteries

https://tech.supercarblondie.com/japan-recovers-up-to-90-of-lithium-from-used-ev-batteries/
478•donohoe•7h ago•114 comments

Alternative(s) to run CUDA on non-Nvidia hardware

https://www.hpcwire.com/2026/07/09/spectral-compute-aims-to-set-cuda-free-will-it-succeed/
33•alok-g•1h ago•12 comments

The git history command

https://lalitm.com/post/git-history/
298•turbocon•9h ago•170 comments

YouTrackDB is a general-use object-oriented graph database

https://github.com/JetBrains/youtrackdb
122•gjvc•6h ago•37 comments

Australian energy retailers must provide three hours of free daytime electricity

https://lenergy.com.au/free-daytime-electricity-is-coming-heres-how-it-actually-works/
92•i2oc•5h ago•118 comments

Indian scientists produce most detailed 3D atlas of the human brainstem

https://www.bbc.com/news/articles/cg53l737v1qo
40•BaudouinVH•3h ago•2 comments

Fundamentals of Wireless Communication (2005)

https://web.stanford.edu/~dntse/wireless_book.html
135•teleforce•7h ago•5 comments

How to build a circular LCD clock

https://blinry.org/lcd-clock/
82•birdculture•2d ago•31 comments

Building and shipping Mac and iOS apps without opening Xcode

https://scottwillsey.com/building-and-shipping-mac-and-ios-apps-without-ever-opening-xcode/
470•speckx•15h ago•204 comments

The Economics of Recursive Self-Improvement [pdf]

https://elasticity.institute/rsi-paper.pdf
97•apsec112•8h ago•35 comments

Zero Knowledge Tolstoyan Art

https://max-amb.github.io/blog/zero_knowledge_tolstoyan_art/
18•max-amb•2d ago•5 comments

An Englishwoman who sketched India before photography took hold

https://www.bbc.com/news/articles/cm2drrv6q54o
153•1659447091•10h ago•46 comments

Satellite Tracker – Live Map of Starlink and 30k Satellites

https://satellitemap.space/
89•rolph•8h ago•39 comments

Is x86 ready to ACE it?

https://chipsandcheese.com/p/is-x86-ready-to-ace-it
77•mfiguiere•8h ago•12 comments

Understanding the Go Runtime: Profiling

https://internals-for-interns.com/posts/go-runtime-profiling/
6•valyala•6d ago•1 comments

Two Case Studies of NaN

https://sebsite.pw/w/20260709-nan.html
5•theanonymousone•1h ago•2 comments

Just Let Me Write Digits

https://gendx.dev/blog/2026/07/13/input-digits.html
23•brandon_bot•3h ago•2 comments

European "age verification" "app" forcing everyone to use Android or iOS

https://github.com/eu-digital-identity-wallet/av-doc-technical-specification/discussions/19
106•roundabout-host•1h ago•57 comments

Jektex 0.2.0 – A Jekyll plugin for LaTeX rendering is now ~10x faster

https://github.com/yagarea/jektex
18•yagarea•2d ago•1 comments

MorphoHDL: A minimalistic language for growing circuits

https://paradigms-of-intelligence.github.io/morpho/
70•jacktang•8h ago•8 comments

Writing a bindless GPU abstraction layer

https://www.kevin-gibson.com/blog/writing-a-bindless-gpu-abstraction-layer/
53•surprisetalk•4d ago•5 comments

World-First 'Super Alloy' Could Transform the Way Metals Are Made

https://www.sciencealert.com/world-first-super-alloy-could-transform-the-way-metals-are-made
66•tejohnso•4d ago•35 comments

The infinite scroll may become endangered if controversial Calif. law passes

https://www.sfgate.com/politics/article/meta-social-media-teenagers-22337724.php
168•Stratoscope•15h ago•293 comments

Our Amish Language

https://www.thedial.world/articles/news/amish-pennsylvania-dutch
49•NaOH•7h ago•28 comments

Nokia’s years of mobile-phone supremacy ended in an afternoon

https://spectrum.ieee.org/nokia-phones-history
124•jruohonen•20h ago•85 comments

Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

https://github.com/Poseidon-fan/linux-0.11-rs
104•arto•13h ago•87 comments

What are Forward Deployed Engineers, and why are they so in demand? (2025)

https://newsletter.pragmaticengineer.com/p/forward-deployed-engineers
62•saisrirampur•10h ago•69 comments

Two Case Studies of NaN

https://sebsite.pw/w/20260709-nan.html
15•ryantsuji•4d ago•3 comments

SalesPatriot (YC W25) Is Hiring Full Stack Engineers (SF)

https://jobs.ashbyhq.com/SalesPatriot/df223727-5781-433e-bc75-2aa5bf8dc8d7
1•maciejSz•12h ago

Linux on the Sega 32X. Who needs hardware synchronization primitives anyway?

https://cakehonolulu.github.io/linux-on-32x/
133•cakehonolulu•15h ago•28 comments