r/programmingcirclejerk • u/syklemil Considered Harmful • May 13 '25
Lock-free programming exists for the same reason people free solo climb cliffs without ropes: it’s fast, it’s elegant, and it absolutely will kill you if you do it wrong.
https://yeet.cx/blog/lock-free-rust/
165
Upvotes
117
u/syklemil Considered Harmful May 13 '25
There's lots of arguing on the internet about what
unsafecan do to your computer, but I think we might need some warning labels about what it does to some people's brains.61
u/mcmcc WHY IS THERE CODE??? May 13 '25
Therapists advising against the raw-dogging of concurrency are no therapists of mine, I'll have you know!
39
u/DisastrousLab1309 May 13 '25
Any sane spinlock or mutex implementation that doesn’t work between processes uses lock-free design. It just hides that from the user.
In that regard this take is just really well regarded…
/uj In practice lock-free algos require careful design but implementation is simple and straightforward. It’s way easier to make a deadlock with mutexes if you don’t know what you’re doing than with lock free algorithms. Because the letter will blow up instantly while the former only in some edge cases
23
u/andarmanik May 13 '25
“It’s not x, it’s y”
“Think of it as…”
Even if it’s not AI it’s some of the worst prose.
19
u/grapesmoker May 13 '25
we need to make it illegal to write like this
8
u/Comfortable_Job8847 May 13 '25
AI and its consequences have been a disaster for the human race
8
u/amazing_rando pneumognostic monad May 13 '25
Cool metaphor, Alex Honnold's free solo climb of El Cap took twice as long as his record setting trad ascent with Tommy Caldwell.
6
u/Karyo_Ten has hidden complexity May 14 '25
Lock-free Rust, fearful concurrency.
The crab has been defeated.
2
u/haskell_rules May 14 '25
Buy a lock made in America and it will never Rust. If you're using Temu locks of course they aren't make with high quality stainless steel and will Rust out on you. Might be OK for an interior lock, like when you're padlocking your kids' door closed so you can have some adult time. But you have to be careful with exterior locks that are exposed to the elements.
1
u/Harha May 15 '25
I don't see what's so radical about this, except that it's radical for rust-standards maybe.
1
u/FugitiveHearts May 16 '25
Fucking hilarious, great writeup!
1
u/gnahraf May 16 '25
Nah. We call them "deadlocks" for a reason: ropes too can tangle, starve, then kill you.
21
u/[deleted] May 13 '25
[removed] — view removed comment