Hacker Newsnew | past | comments | ask | show | jobs | submit | liquid153's commentslogin

What a dumb app


Found the guitarist


As a guitarist I tend blame the bass players of the world.


Aren't lock free buffers usually just as expensive or more expensive to use as locks.


No -- for a lock-free design with a single producer and consumer, it's possible both are typically writing to independent regions of memory. With a lock, both have to write the same cache line to take and release the lock.


Not if your program needs to be realtime or near realtime safe. Locks are controlled by the OS typically, and can have non-deterministic latency.


Even ignoring mutexes and OS scheduling, plain spinlocks add contention that would not otherwise exist in a SPSC ringbuffer. https://news.ycombinator.com/item?id=39551575


Lock free has two advantages: the checking code can run in user mode and non-contested access is very cheap with just one instruction.

To do it correctly, lock needs to be done in the kernel thus obtaining a lock requires calling into the kernel which is more expensive.

I think you meant the memory barrier for syncing cache is just as expensive as the lock version, which is true.


Obtaining an uncontested lock absolutely doesn't require calling into the kernel


How can you give hard guarantees that on Windows, Mac, Linux with the OS and/or libc provided locks?


If you really really really need such a guarantee, you implement your own.

Otherwise you inspect the implementation, but in 2024 a fast-pathed OS lock is table stakes.


Rust (which is what we're discussing here) actually doesn't promise this in general. But for the three operating systems you mentioned that is in fact what it delivers because as another commenter mentioned it's table stakes. If your OS can't do this it's a toy OS.

The Windows and Linux solutions are by Mara Bos (the MacOS one might be too, I don't know)

The Windows one is very elegant but opaque. Basically Microsoft provides an appropriate API ("Slim Reader/Writer Locks") and Mara's code just uses that API.

The Linux one shows exactly how to use a Futex: if you know what a futex is, yeah, Rust just uses a futex. If you don't, go read about the Futex, it's clever.


Because not doing that these days would be malpractice for an OS of that caliber.


No, where are you getting that information?


No, thanks. Uber is notorious for subpar low quality OSS


Huh. Do you have a few examples?

I thought jaeger was pretty popular for tracing.


No mention of typed enums and nullptr. Small things but makes dev experience better


No they’re not


Lame. Product is DOA


Would love to hear your thoughts on why its DOA? We are still discovering the right UX, interaction points


no it hasn't, down vote due to advert


I thought you can't downvote stories... Did you mean flag?


Is this like constexpr in C++


homebrew sucks it's super slow


What alternatives can you recommend? What makes them better?


I've been using nix through devbox [0] & direnv recently for an elixir project.

The experience has been good so far:

- Fully reproducible.

- Does not install things globally, rather on a per-project (directory) basis.

- Reasonably fast

One of the downsides is that cutting-edge releases of packages are not available as quickly as with other means.

[0] : https://www.jetpack.io/devbox/


Not Apache Kafka RTFM


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: