frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Aiologic – GIL-powered* locking library for Python

https://github.com/x42005e1f/aiologic
3•x42005e1f•1mo ago
Well, I guess better now than never.

Hello, Hacker News readers. My name is Ilya Egorov, and for the past year I have been developing a somewhat esoteric library for Python. The idea behind it is quite simple: primitives (such as locks) that work in different environments at the same time (for example, an asyncio thread and any other threads), one instance for everything (both async-aware and thread-aware/thread-safe), without complicating things for the user.

It all started sometime around 2022-2023, when I was writing a bridge between different messengers (APIs) on AnyIO for personal use. At the time, I wanted to achieve fairness in processing different chats, but part of the work was CPU-bound, and isolating it into separate synchronous threads would have led to noticeable overhead. The most logical thing that came to mind at that moment was to parallelize all asynchronous code, one "asynchronous" thread for each chat (nowadays, such ideas have been popularized with the advent of free-threading), in order to take advantage of preemptive multitasking. But how to synchronize and communicate between different tasks in different threads when none of the available asynchronous primitives are thread-safe? I did not like any of the workarounds known at the time, so I started writing my own.

In 2023, I tried various approaches to creating a universal lock, which I called an "atomic lock" (since I planned to implement other primitives I needed on top of it). The principle of operation is quite simple: each instance uses collections.deque as a token queue (lock owners; something very similar is used in the current implementation of aiologic.lowlevel.ThreadOnceLock) and threading.Lock to synchronize the internal logic. It seemed like everything was working, and I could have stopped there, but the latter bothered me. As long as my lock used threading.Lock, known for blocking event loops and thus causing timeout issues, there could be no question of its fairness. However, all I could achieve at that point was to define the lock recurrently (where the event loop blocking time decreased with increasing nesting but increased overhead for each call).

In the spring of 2024, after digging deep into atomic programming (especially lock-free and wait-free queues), it hit me that something similar could be implemented at the Python level. I did not decide to use effectively atomic operations right away, since almost no one had done so before me (the information available on them is very poor, and I had to research it all myself), but after seeing how reliable they are (they are even used in standard CPython tests, and free-threading fixes are also related to them), I created the first primitive that works without synchronization of internal logic. My worldview changed, and I went on to create other primitives, also without synchronization. A few months later, in August 2024, aiologic was born.

Now, a year later, the library is already quite well developed. It supports a wide variety of concurrency libraries, whether it is gevent or Trio, and everything with as many threads as you want. There are locks, semaphores, queues, and others. A brief description is somewhat humorous: "GIL-powered" but supports free-threading (in essence, this is about effectively atomic operations, which is very interesting on PyPy - see the classic benchmark); "locking" but almost never uses locks under the hood (except in some special cases). The development status is still alpha, but in my opinion, the reliability is quite high, as I constantly recheck the implementation with proactive bug fixing (see the overly detailed logs).

I hope you find my library interesting.

CoreWeave's $30B Bet on GPU Market Infrastructure

https://davefriedman.substack.com/p/coreweaves-30-billion-bet-on-gpu
1•gmays•1m ago•0 comments

Creating and Hosting a Static Website on Cloudflare for Free

https://benjaminsmallwood.com/blog/creating-and-hosting-a-static-website-on-cloudflare-for-free/
1•bensmallwood•7m ago•1 comments

"The Stanford scam proves America is becoming a nation of grifters"

https://www.thetimes.com/us/news-today/article/students-stanford-grifters-ivy-league-w2g5z768z
1•cwwc•11m ago•0 comments

Elon Musk on Space GPUs, AI, Optimus, and His Manufacturing Method

https://cheekypint.substack.com/p/elon-musk-on-space-gpus-ai-optimus
2•simonebrunozzi•20m ago•0 comments

X (Twitter) is back with a new X API Pay-Per-Use model

https://developer.x.com/
2•eeko_systems•27m ago•0 comments

Zlob.h 100% POSIX and glibc compatible globbing lib that is faste and better

https://github.com/dmtrKovalenko/zlob
1•neogoose•30m ago•1 comments

Show HN: Deterministic signal triangulation using a fixed .72% variance constant

https://github.com/mabrucker85-prog/Project_Lance_Core
1•mav5431•30m ago•1 comments

Scientists Discover Levitating Time Crystals You Can Hold, Defy Newton’s 3rd Law

https://phys.org/news/2026-02-scientists-levitating-crystals.html
3•sizzle•30m ago•0 comments

When Michelangelo Met Titian

https://www.wsj.com/arts-culture/books/michelangelo-titian-review-the-renaissances-odd-couple-e34...
1•keiferski•32m ago•0 comments

Solving NYT Pips with DLX

https://github.com/DonoG/NYTPips4Processing
1•impossiblecode•32m ago•1 comments

Baldur's Gate to be turned into TV series – without the game's developers

https://www.bbc.com/news/articles/c24g457y534o
2•vunderba•32m ago•0 comments

Interview with 'Just use a VPS' bro (OpenClaw version) [video]

https://www.youtube.com/watch?v=40SnEd1RWUU
1•dangtony98•38m ago•0 comments

EchoJEPA: Latent Predictive Foundation Model for Echocardiography

https://github.com/bowang-lab/EchoJEPA
1•euvin•46m ago•0 comments

Disablling Go Telemetry

https://go.dev/doc/telemetry
1•1vuio0pswjnm7•47m ago•0 comments

Effective Nihilism

https://www.effectivenihilism.org/
1•abetusk•50m ago•1 comments

The UK government didn't want you to see this report on ecosystem collapse

https://www.theguardian.com/commentisfree/2026/jan/27/uk-government-report-ecosystem-collapse-foi...
4•pabs3•53m ago•0 comments

No 10 blocks report on impact of rainforest collapse on food prices

https://www.thetimes.com/uk/environment/article/no-10-blocks-report-on-impact-of-rainforest-colla...
2•pabs3•53m ago•0 comments

Seedance 2.0 Is Coming

https://seedance-2.app/
1•Jenny249•54m ago•0 comments

Show HN: Fitspire – a simple 5-minute workout app for busy people (iOS)

https://apps.apple.com/us/app/fitspire-5-minute-workout/id6758784938
1•devavinoth12•55m ago•0 comments

Dexterous robotic hands: 2009 – 2014 – 2025

https://old.reddit.com/r/robotics/comments/1qp7z15/dexterous_robotic_hands_2009_2014_2025/
1•gmays•59m ago•0 comments

Interop 2025: A Year of Convergence

https://webkit.org/blog/17808/interop-2025-review/
1•ksec•1h ago•1 comments

JobArena – Human Intuition vs. Artificial Intelligence

https://www.jobarena.ai/
1•84634E1A607A•1h ago•0 comments

Concept Artists Say Generative AI References Only Make Their Jobs Harder

https://thisweekinvideogames.com/feature/concept-artists-in-games-say-generative-ai-references-on...
1•KittenInABox•1h ago•0 comments

Show HN: PaySentry – Open-source control plane for AI agent payments

https://github.com/mkmkkkkk/paysentry
2•mkyang•1h ago•0 comments

Show HN: Moli P2P – An ephemeral, serverless image gallery (Rust and WebRTC)

https://moli-green.is/
2•ShinyaKoyano•1h ago•1 comments

The Crumbling Workflow Moat: Aggregation Theory's Final Chapter

https://twitter.com/nicbstme/status/2019149771706102022
1•SubiculumCode•1h ago•0 comments

Pax Historia – User and AI powered gaming platform

https://www.ycombinator.com/launches/PMu-pax-historia-user-ai-powered-gaming-platform
2•Osiris30•1h ago•0 comments

Show HN: I built a RAG engine to search Singaporean laws

https://github.com/adityaprasad-sudo/Explore-Singapore
3•ambitious_potat•1h ago•4 comments

Scams, Fraud, and Fake Apps: How to Protect Your Money in a Mobile-First Economy

https://blog.afrowallet.co/en_GB/tiers-app/scams-fraud-and-fake-apps-in-africa
1•jonatask•1h ago•0 comments

Porting Doom to My WebAssembly VM

https://irreducible.io/blog/porting-doom-to-wasm/
2•irreducible•1h ago•0 comments