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.

Cyberattack Campaign Compromising Check Point Servers Across 22 Organizations

https://www.greynoise.io/blog/check-point-security-management-servers-intrusion-campaign
24•louiereederson•21m ago•2 comments

Tidal Bans AI-Generated Music

https://variety.com/2026/music/news/tidal-bans-ai-generated-music-1236956924/
103•theanonymousone•40m ago•63 comments

2035 came early

https://fzakaria.com/2026/11/23/2035-came-early
720•setheron•10h ago•268 comments

Jetty Pro

http://hypercritical.co/2026/11/23/jetty-pro
11•zdw•30m ago•0 comments

A training engine for your local model, using your idle compute

https://github.com/sous-labs/songe
34•bluepeter•1h ago•3 comments

LLM agents work for their parent companies, not for you

https://michaelharley.net/posts/2026/11/01/llm-agents-work-for-their-parent-companies-not-for-you/
574•surprisetalk•4h ago•241 comments

Worshipping at the altar of Brendan Gregg

https://fzakaria.com/2026/11/12/worshipping-at-the-altar-of-brendan-gregg
157•kqr•6h ago•24 comments

Quad9 pulled their DNS service from France

https://quad9.net/news/blog/quad9-service-deactivation-in-france/
173•farrokhi•8h ago•69 comments

How a Mechanical Watch Keeps Time (Interactive 3D)

https://martincmartin.github.io/slidev-stem/watches/article/1/
123•martincmartin•2d ago•32 comments

Splitting USB-C: USB 3 and USB 2 on One Port

https://www.frankchiarulli.com/blog/splitting-usb-c/
6•fcjr•1h ago•0 comments

Ladybird is now in alpha

https://ladybird.org/posts/alpha/
2306•janvdberg•1d ago•564 comments

Mechanical Pencil: Spray Bottle

https://mechanical-pencil.com/products/spray-bottle
14•vinhnx•2d ago•4 comments

SeaStore: Redesigning Ceph's Storage Back End for CPU-Efficient NVMe Performance

https://dl.acm.org/doi/10.1145/3828523.3857112
26•shraddhaag•1d ago•0 comments

Stalwart is now a drop-in replacement for Microsoft Exchange

https://stalw.art/blog/microsoft-exchange-replacement/
633•shaunpud•18h ago•318 comments

An anti-slavery sugar bowl (2024)

https://www.vam.ac.uk/blog/museum-life/an-anti-slavery-sugar-bowl
84•leonry•2d ago•53 comments

How to Make a Lovable City

https://www.worksinprogress.news/p/how-to-make-a-lovable-city
7•crescit_eundo•33m ago•0 comments

Just a Few Bugs

https://www.justafewbugs.xyz/
99•jjjegly•7h ago•32 comments

AMD EPYC Zen 6 vs. Zen 1 Performance: 12.1x Geo Mean in Less Than 10 Years

https://www.phoronix.com/review/amd-epyc-9006-7601
186•zdw•11h ago•97 comments

GTA 6 Recomp (Leonida) banned from GitHub while lead dev was in school

https://github.com/ItsNotRexed/Leonida/issues
232•smuhakg•14h ago•361 comments

Nvidia Reinstates Jensen Huang as CEO

https://www.cnbc.com/2026/11/23/nvidia-jensen-huang-ceo.html
2731•jaz•1d ago•3591 comments

The new set of problems for engineers to solve

https://www.katelynlesse.com/blog/new-problems-for-engineers-to-solve
74•ot•1d ago•54 comments

Drone Maps of Salvage Yards

https://salvageyarddrone.wordpress.com/
150•uptrails•12h ago•58 comments

Del Casher–guitarist who was driving force behind the wah-wah pedal–dies at 88

https://www.nytimes.com/2026/11/17/obituaries/del-casher-dead.html
50•bookofjoe•2d ago•11 comments

GPUI is getting its own repository

https://github.com/zed-industries/gpui
354•EvilGoose•20h ago•127 comments

Declare is a UI language for you and your AI

https://davidtemkin.github.io/declarelang/
90•ilamont•14h ago•67 comments

New York Bans Subscription and Post-Purchase Fees on Cars

https://www.governor.ny.gov/news/money-your-pockets-governor-hochul-signs-bill-restricting-exploi...
670•DeepLogin•14h ago•306 comments

Ex-Nvidia partner Megaspeed hit with U.S. Commerce Department export ban

https://www.upi.com/Top_News/US/2026/11/24/NVIDIA-partner-Megaspeed/1701795520063/
14•nephihaha•44m ago•5 comments

Arctic: A Practical Lock-Free Adaptive Radix Tree

https://www.usenix.org/conference/osdi26/presentation/ni
83•grep_it•2d ago•10 comments

Bored.com: Fun, interesting and cool websites to explore when bored

https://www.bored.com/
312•susam•19h ago•65 comments

"Dario is hyping the dangers so OSS models are illegal and he stays in control"

https://twitter.com/ylecun/status/2124550037912920090
1928•MrBuddyCasino•23h ago•1119 comments