frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

GNU Midnight Commander

https://midnight-commander.org/
284•pykello•6h ago•157 comments

Notion API importer, with Databases to Bases conversion bounty

https://github.com/obsidianmd/obsidian-importer/issues/421
104•twapi•4h ago•23 comments

Shai-Hulud malware attack: Tinycolor and over 40 NPM packages compromised

https://socket.dev/blog/ongoing-supply-chain-attack-targets-crowdstrike-npm-packages
1034•jamesberthoty•22h ago•836 comments

The Asus Gaming Laptop ACPI Firmware Bug: A Deep Technical Investigation

https://github.com/Zephkek/Asus-ROG-Aml-Deep-Dive
193•signa11•6h ago•90 comments

Murex – An intuitive and content aware shell for a modern command line

https://murex.rocks/
41•modinfo•3h ago•13 comments

Why We're Building Stategraph: Terraform State as a Distributed Systems Problem

https://stategraph.dev/blog/why-stategraph/
10•lawnchair•1h ago•3 comments

Things you can do with a Software Defined Radio (2024)

https://blinry.org/50-things-with-sdr/
802•mihau•19h ago•132 comments

Tabby – A Terminal for the Modern Age

https://github.com/Eugeny/tabby
23•modinfo•3h ago•13 comments

Doom crash after 2.5 years of real-world runtime confirmed on real hardware

https://lenowo.org/viewtopic.php?t=31
269•minki_the_avali•12h ago•79 comments

DataTables CDN Outage – post incident review

https://datatables.net/blog/2025/july-29-outage
8•cristoperb•14h ago•3 comments

Normal-order syntax-rules and proving the fix-point of call/cc

https://okmij.org/ftp/Scheme/callcc-calc-page.html
23•Bogdanp•3d ago•0 comments

How to make the Framework Desktop run even quieter

https://noctua.at/en/how-to-make-the-framework-desktop-run-even-quieter
276•lwhsiao•15h ago•86 comments

Denmark close to wiping out cancer-causing HPV strains after vaccine roll-out

https://www.gavi.org/vaccineswork/denmark-close-wiping-out-leading-cancer-causing-hpv-strains-aft...
767•slu•15h ago•297 comments

I got the highest score on ARC-AGI again swapping Python for English

https://jeremyberman.substack.com/p/how-i-got-the-highest-score-on-arc-agi-again
79•freediver•8h ago•23 comments

A dumb introduction to z3

https://asibahi.github.io/thoughts/a-gentle-introduction-to-z3/
205•kfl•1d ago•30 comments

In Praise of Idleness (1932)

https://harpers.org/archive/1932/10/in-praise-of-idleness/
52•awanderingmind•4h ago•7 comments

Samsung 870 QVO 4TB SATA SSD-s: how are they doing after 4 years of use?

https://ounapuu.ee/posts/2025/09/15/samsung-870-qvo/
36•furkansahin•2d ago•7 comments

AMD Open Source Driver for Vulkan project is discontinued

https://github.com/GPUOpen-Drivers/AMDVLK/discussions/416
82•haunter•9h ago•17 comments

About the security content of iOS 15.8.5 and iPadOS 15.8.5

https://support.apple.com/en-us/125142
315•jerlam•9h ago•130 comments

Tuberculosis shaped Victorian fashion (2016)

https://www.smithsonianmag.com/science-nature/how-tuberculosis-shaped-victorian-fashion-180959029/
21•franze•2d ago•7 comments

Waymo has received our pilot permit allowing for commercial operations at SFO

https://waymo.com/blog/#short-all-systems-go-at-sfo-waymo-has-received-our-pilot-permit
639•ChrisArchitect•17h ago•635 comments

I built my own phone because innovation is sad rn [video]

https://www.youtube.com/watch?v=qy_9w_c2ub0
253•Timothee•2d ago•46 comments

CubeSats are fascinating learning tools for space

https://www.jeffgeerling.com/blog/2025/cubesats-are-fascinating-learning-tools-space
49•calcifer•3d ago•3 comments

Bertrand Russell to Oswald Mosley (1962)

https://lettersofnote.com/2016/02/02/every-ounce-of-my-energy/
224•giraffe_lady•17h ago•104 comments

Should we drain the Everglades?

https://rabbitcavern.substack.com/p/should-we-drain-the-everglades
96•ksymph•14h ago•89 comments

How Container Filesystem Works: Building a Docker-Like Container from Scratch

https://labs.iximiuz.com/tutorials/container-filesystem-from-scratch
153•lgunsch•3d ago•27 comments

In Defense of C++

https://dayvster.com/blog/in-defense-of-cpp/
137•todsacerdoti•14h ago•258 comments

I just want an 80×25 console, but that's no longer possible

https://changelog.complete.org/archives/10881-i-just-want-an-80x25-console-but-thats-no-longer-po...
62•teddyh•5h ago•61 comments

Top UN legal investigators conclude Israel is guilty of genocide in Gaza

https://www.middleeasteye.net/news/un-concludes-israel-guilty-genocide-gaza
1064•Qem•1d ago•833 comments

Meta RayBan AR glasses shows Lumus waveguide structures in leaked video

https://kguttag.com/2025/09/16/meta-rayban-ar-glasses-shows-lumus-waveguide-structures-in-leaked-...
93•speckx•15h ago•100 comments
Open in hackernews

Lock-Free Rust: How to Build a Rollercoaster While It's on Fire

https://yeet.cx/blog/lock-free-rust/
133•r3tr0•4mo ago

Comments

r3tr0•4mo ago
hope you enjoy this article on lock free programming in rust.

I used humor and analogies in the article not just to be entertaining, but to make difficult concepts like memory ordering and atomics more approachable and memorable.

tombert•4mo ago
Interesting read, I enjoyed it and it answered a question that I didn't even realize I had been asking myself for years, which is how lock-free structures work.

Have you looked at CTries before? They're pretty interesting, and I think are probably the future of this space.

nmca•4mo ago
Did you get help from ChatGPT ooi? The humour sounds a bit like modern ChatGPT style but it’s uncanny valley.
bobbyraduloff•4mo ago
at the very least that article was definitely edited with ChatGPT. i had someone on my team write “edgy” copy with ChatGPT last week and it sounded exactly the same. short paragraphs and overuse of bullet points are also a dead giveaway. i don’t think it’s super noticeable if you don’t use ChatGPT a lot but for the people that use these systems daily, it’s still very easy to spot.

my suggestion to OP: this was interesting material, ChatGPT made it had to read. use your own words to explain it. most people interested in this deeply technical content would rather read your prompt than the output.

zbentley•4mo ago
As someone who overused bullet points before it was AI-cool and doesn’t write with the assistance of AI (not due to a general anti-AI belief, I just like writing by hand) I have also started getting that feedback a lot lately.

Who knows, maybe someone accidentally over-weighted my writing by a factor of a trillion in ChatGPT’s training set?

r3tr0•4mo ago
i had help GPT help with some grammar, editing, and shortening.

The core ideas, jokes, code, and analogies are 100% mine.

Human chaos. Machine polish.

tombert•4mo ago
Pretty interesting.

I have finally bitten the bullet and learned Rust in the last few months and ended up really liking it, but I have to admit that it's a bit lower level than I generally work in.

I have generally avoided locks by making very liberal use of Tokio channels, though that isn't for performance reasons or anything: I just find locks really hard to reason about for anything but extremely trivial usecases, and channels are a more natural abstraction for me.

I've never really considered what goes into these lock-free structures, but that might be one of my next "unemployment projects" after I finish my current one.

forgot_old_user•4mo ago
definitely! Reminds me of the golang saying

> Don't Communicate by Sharing Memory; Share Memory by Communicating

https://www.php.cn/faq/1796714651.html

tombert•4mo ago
Yeah, similarly, Joe Armstrong (RIP), co-creator of Erlang explained it to me like this:

> In distributed systems there is no real shared state (imagine one machine in the USA another in Sweden) where is the shared state? In the middle of the Atlantic? — shared state breaks laws of physics. State changes are propagated at the speed of light — we always know how things were at a remote site not how they are now. What we know is what they last told us. If you make a software abstraction that ignores this fact you’ll be in trouble.

He wrote this to me in 2014, and it has really informed how I think about these things.

throwawaymaths•4mo ago
The thing is that go channels themselves are shared state (if the owner closes the channel and a client tries to write you're not gonna have a good time)! Erlang message boxes are not.
kbolino•4mo ago
You don't have to close a channel in Go and in many cases you actually shouldn't.

Even if you choose to close a channel because it's useful to you, it's not necessarily shared state. In a lot of cases, closing a channel behaves just like a message in its queue.

tombert•4mo ago
Strictly speaking they’re shared state, but the way you model your application around channels is generally to have independent little chunks of work and the channels are just a means of communicating. I know it’s not one-for-one with Erlang.
Kubuxu•4mo ago
You can think of closing the channel as sending a message “there will be no further messages”, the panic on write is enforcement of that contract.

Additionally the safe way to use closing of a channel is the writer closing it. If you have multiple writers, you have to either synchronise them, or don’t close the channel.

throwawaymaths•4mo ago
Sure but the fact that it is shared state is why you can't naively have a go channel that spans a cluster but Erlang's "actor" system works just fine over a network and the safety systems (nodedowns, monitors etc) are a simple layer on top.
aatd86•4mo ago
Isn't entanglement in quantum physics the manifestation of shared state? tongue-in-cheek
psychoslave•4mo ago
Maybe. Or maybe we observe the same point of information source from two points which happen to be distant in the 3-coordinates we are accustomized to deal with, but both close to this single point in some other.
aatd86•3mo ago
but that still means that there is shared state on the projection from the higher tensor space.

orthogonality needs to be valid for all subspaces.

gpderetta•4mo ago
> Don't Communicate by Sharing Memory; Share Memory by Communicating

that's all well and good until you realize you are reimplementing a slow, buggy version of MESI in software.

Proper concurrency control is the key. Shared memory vs message passing is incidental and application specific.

revskill•4mo ago
How can u be unemployed ?
tombert•4mo ago
Just the market. I don’t have a lot of reasons outside of that.
psychoslave•4mo ago
By the default state of any entity in universe which is to not be employed?
0x1ceb00da•4mo ago
> AtomicUsize: Used for indexing and freelist linkage. It’s a plain old number, except it’s watched 24 / 7 by the CPU’s race condition alarm.

Is it though? Aren't atomic load/store instructions the actual important thing. I know the type system ensures that `AtomicUsize` can only be accessed using atomic instructions but saying it's being watched by the CPU is inaccurate.

eslaught•4mo ago
I'm not sure what the author intended, but one way to implement atomics at the microarchitectural level is via a load-linked/store-conditional pair of instructions, which often involves tracking the cache line for modification.

https://en.wikipedia.org/wiki/Load-link/store-conditional

It's not "24/7" but it is "watching" in some sense of the word. So not entirely unfair.

ephemer_a•4mo ago
did 4o write this
fefe23•4mo ago
To borrow an old adage: The determined programmer can write C code in any language. :-)
MobiusHorizons•4mo ago
Atomics are hardly “C”. They are a primative exposed many CPU ISAs for helping to navigate the complexity those same CPUs introduced with OOO execution and complex caches in a multi-threaded environment. Much like simd atomics require extending the language through intrinsics or new types because they represent capabilities that were not possible when the language was invented. Atomics require this extra support in Java just as they do in rust or C.
MobiusHorizons•4mo ago
I enjoyed the content, but could have done without the constant hyping up of the edginess of lock free data structures. I mean yes, like almost any heavily optimized structure there are trade offs that prevent this optimization from being globally applicable. But also being borderline aroused at the “danger” and rule breaking is tiresome and strikes me as juvenile.
bigstrat2003•4mo ago
To each their own. I thought it was hilarious and kept the article entertaining throughout, with what would otherwise be a fairly dry subject.
atoav•4mo ago
It is juvenile, but what do we know? Real Men use after free, so they wouldn't even use Rust to begin with.

The edgy tones sound like from an LLM to me..

lesser23•4mo ago
The bullet points and some of the edge definitely smell like LLM assistance.

Other than that I take the other side. I’ve read (and subsequently never finished) dozens of programming books because they are so god awfully boring. This writing style, perhaps dialed back a little, helps keep my interest. I like the feel of a zine where it’s as technical as a professional write up but far less formal.

I often find learning through analogy useful anyway and the humor helps a lot too.

zero0529•4mo ago
Like the writing style but would prefer if it was dialed down maybe 10 %. Otherwise a great article as an introduction to lock-free datastructures.
Animats•4mo ago
I've done a little bit of "lock-free" programming in Rust, but it's for very specialized situations.[1] This allocates and releases bits in a bitmap. The bitmap is intended to represent the slots in use in the Vulkan bindless texture index, which resides in the GPU. Can't read that those slots from the CPU side to see if an entry is in use. So in-use slots in that table have to be tracked with an external bitmap.

This has no unsafe code. It's all done with compare and swap. There is locking here, but it's down at the hardware level within the compare and swap instruction. This is cleaner and more portable than relying on cross-CPU ordering of operations.

[1] https://github.com/John-Nagle/rust-vulkan-bindless/blob/main...

jillesvangurp•4mo ago
This is the kind of stuff that you shouldn't have to reinvent yourself but be able to reuse from a good library. Or the standard library even.

How would this compare to the lock free abstractions that come with e.g. the java.concurrent package? It has a lot of useful primitives and data structures. I expect the memory overhead is probably worse for those.

Support for this is one of the big reason Java and the jvm has been a popular choice for companies building middleware and data processing frameworks for the last few decades. Exactly the kind of stuff that the author of this article is proposing you could build with this. Things like Kafka, Lucene, Spark, Hadoop, Flink, Beam, etc.

gpderetta•4mo ago
> This is the kind of stuff that you shouldn't have to reinvent yourself but be able to reuse from a good library. Or the standard library even.

Indeed; normally we call it the system allocator.

A good system allocator will use per thread or per cpu free-lists so that it doesn't need to do CAS loops for every allocation though. At the very least will use hashed pools to reduce contention.

gpderetta•4mo ago
The claim that the lock free array is faster then the locked variant is suspicious. The lock free array is performing a CAS for every operation, this is going to dominate[1]. A plain mutex would do two CAS (or just one if it is a spin lock), so the order of magnitude difference is not explainable by the lock free property.

Of course if the mutex array is doing a linear scan to find the insertion point that would explain the difference but: a) I can't see the code for the alternative and b) there is no reason why the mutex variant can't use a free list.

Remember:

- Lock free doesn't automatically means faster (still it has other properties that might be desirable even if slower)

- Never trust a benchmark you didn't falsify yourself.

[1] when uncontended; when contended cache coherence cost will dominate over everything else, lock-free or not.

michaelscott•4mo ago
For applications doing extremely high rates of inserts and reads, lock free is definitely superior. In extreme latency sensitive applications like trading platforms (events processing sub 100ms) it's a requirement; locked structures cause bottlenecks at high throughput
bonzini•4mo ago
Yes the code for the alternative is awful. However I tried rewriting it with a better alternative (basically the same as the lock free code, but with a mutex around it) and was still 40% slower. See FixedVec in https://play.rust-lang.org/?version=stable&mode=release&edit...
gpderetta•4mo ago
Given twice the number of CASs, about twice as slow is what I would expect for the mutex variant when uncontended. I don't know enough rust to fix it myself, but could you try with a spin lock?

As the benchmark is very dependent on contention, it would give very different results if the the threads are scheduled serially as opposed to running truly concurrently (for example using a spin lock would be awful if running on a single core).

So again, you need to be very careful to understand what you are actually testing.

r3tr0•4mo ago
totally valid.

that benchmarking is something i should have added more alternatives to.

j_seigh•4mo ago
I did a lock-free ABA-free bounded queue in c++ kind of an exercise. I work mostly with deferred reclamation schemes (e.g. refcounting, quiescent state based reclamation, and epoch based reclamation). A queue requiring deferred reclamation, like the Michael-Scott lock-free queue is going to perform terribly so you go with an array based ring buffer. It uses a double wide CAS to do the insert for the enqueue and a regular CAS to update the tail. Dequeue is just a regular CAS to update the head. That runs about 57 nsecs on my 10th gen i5 for single producer and consumer.

A lock-free queue by itself isn't very useful. You need a polling strategy that doesn't involve a busy loop. If you use mutexes and condvars, you've basically turned it into a lock based queue. Eventcounts work much better.

If I run more threads than CPUs and enough work so I get time slice ends, I get about 1160 nsecs avg enq/deq for mutex version, and about 146 nsecs for eventcount version.

Timings will vary based on how man threads you use and cpu affinity that takes your hw thread/core/cache layout into consideration. I have gen 13 i5 that runs this slower than my gen 10 i5 because of the former's efficiency cores even though it is supposedly faster.

And yes, a queue is a poster child for cache contention problems, une enfant terrible. I tried a back off strategy at one point but it didn't help any.

convivialdingo•4mo ago
I tried replacing a DMA queue lock with lock-free CAS and it wasn't faster than a mutex or a standard rwlock.

I rewrote the entire queue with lock-free CAS to manage insertions/removals on the list and we finally got some better numbers. But not always! We found it worked best either as a single thread, or during massive contention. With a normal load it wasn't really much better.

sennalen•4mo ago
The bottleneck is context switching
scripturial•4mo ago
So don’t bother to optimize anything?
jonco217•4mo ago
> NOTE: In this snippet we ignore the ABA problem

The article doesn't go into details but this is subtle way to mess up writing lock free data structures:

https://en.wikipedia.org/wiki/ABA_problem

r3tr0•4mo ago
i will do another one on just the ABA problem and how many different ways it can put your program in the hospital.
lucraft•4mo ago
Can I ask a dumb question - how is Atomic set operation implemented internally if not by grabbing a lock?
moring•4mo ago
Two things that come to my mind:

1. Sometimes "lock-free" actually means using lower-level primitives that use locks internally but don't expose them, with fewer caveats than using them at a higher level. For example, compare-and-set instructions offered by CPUs, which may use bus locks internally but don't expose them to software.

2. Depending on the lower-level implementation, a simple lock may not be enough. For example, in a multi-CPU system with weaker cache coherency, a simple lock will not get rid of outdated copies of data (in caches, queues, ...). Here I write "simple" lock because some concepts of a lock, such as Java's "synchronized" statement, bundle the actual lock together with guaranteed cache synchronization, whether that happens in hardware or software.

gpderetta•4mo ago
Reminder that lock-free is a term of art with very specific meaning about starvation-freedom and progress and has very little to do with locking.
gpderetta•4mo ago
The hardware itself is designed to guarantee it. For example, the core guarantees that it will perform the load + compare + store from a cacheline in a finite number of cycles, while the cache coherency protocol guarantees that a) the core will eventually (i.e. it is fair) be able to acquire the cacheline in exclusive mode and b) will be able to hold it for a minimum number of clock cycles before another core forces an eviction or a downgrade of the ownership.
sophacles•4mo ago
Most hardware these days has intrinsic atomics - they are built into the hw in various ways, both in memory model guarantees (e.g. x86 has a very strong guarantees of cache coherency, arm not so much), and instructions (e.g. xchg on x86). The deatails vary a lot between different cpu architectures, which is why C++ and Rust have memory models to program to rather than the specific semantics of a given arch.
Asraelite•4mo ago
It does use locks. If you go down deep enough you eventually end up with hardware primitives that are effectively locks, although they might not be called that.

The CPU clock itself can be thought of as a kind of lock.

Fiahil•4mo ago
You can go one step further if :

- you don't reallocate the array

- you don't allow updating/ removing past inserted values

In essence it become a log, a Vec<OnceCell<T>> or a Vec<UnsafeCell<Option<T>>>. Works well, but only for a bounded array. So applications like messaging, or inter-thread communication are not a perfect fit.

It's a fixed-size vector that can be read at the same time it's being written to. It's no a common need.

pjmlp•4mo ago
That screenshot is very much CDE inspired.
sph•4mo ago
Obligatory video from Jon Gjengset “Crust of Rust: Atomics and Memory Ordering”: https://youtu.be/rMGWeSjctlY?si=iDhOLFj4idOOKby8
gmm1990•4mo ago
Is the advantage of a freelist over just an array of the values (implemented like a ring buffer), that you can don't have to consume values in order? It just seems like throwing a pointer lookup would add a lot of latency for something thats so latency sensitive.
rurban•4mo ago
It still wouldn't lead to proper Rust concurrency safety, because their IO is still blocking.
zbentley•4mo ago
What’s blocking IO have to do with this topic?

Also, I don’t feel like that’s true: Rust has the exact same non blocking IO primitives in the stdlib as any other systems language: O_NONBLOCK, multiplexers, and so on. Combined with async/await syntax sugar for concurrency and backends like Tokyo, I’m not sure how you end up at “rust IO is still blocking”.

rurban•4mo ago
Lock-freeness is an important step to concurrency safety. Rust falsely calls itself concurrency safe.

For a system language it's great to finally have a lock free library for some containers, but that's still not safe.

IX-103•4mo ago
> We don’t need strict ordering here; we’re just reading a number.

That's probably the most scary sentence in the whole article.

Havoc•4mo ago
wow - that's a huge speed improvement.

I wonder if this is connected to that rust optimisation bounty post we saw the other day where they couldn't get rust safe decoder closer than 5% to their C implementation. Maybe that's just the cost of safety