Live data from Hacker News

Restartable Sequences

justine.lol

31–40 of 82 posts

Re: Restartable Sequences

#31
> chances are the CPU's internal mutexes aren't as good as the ones you've implemented in userspace

Anyone with an informed opinion on this statement? It's seems counter intuitive (npi).

Re: Restartable Sequences

#32

> chances are the CPU's internal mutexes aren't as good as the ones you've implemented in userspace Anyone with an informed opinion on this statement? It's seems counter intuitive (npi).

The author is referring to false sharing (https://en.wikipedia.org/wiki/False_sharing). CPU caches operate at cache line granularity (typically 64 bytes) so writes to one part of the cache line can require synchronization with writes to non-overlapping parts of the same cache line. This can dramatically reduce performance when there are a large number of cores operating on the same cache line.

If you remove the 64 byte alignment (which forces each counter variable onto a separate cache line) from hitcounter-shard.c you ought to be able to see the performance difference for yourself.

Re: Restartable Sequences

#33
post #32

> chances are the CPU's internal mutexes aren't as good as the ones you've implemented in userspace Anyone with an informed opinion on this statement? It's seems counter intuitive (npi).

The author is referring to false sharing ( https://en.wikipedia.org/wiki/False_sharing ). CPU caches operate at cache line granularity (typically 64 bytes) so writes to one part of the cache line can require synchronization with writes to non-overlapping parts of the same cache line. This can dramatically reduce performance when there are a large number of cores operating on the same cache line. If you remove the 64…

Thanks for the effort but the q wasn't "what is false sharing",

The Q is: is it true the CPU mutexes are actually slower than those implemented in userspace?

Re: Restartable Sequences

#34

Earlier quoted context omitted.

Do you have a link?

https://web.archive.org/web/20260529122658/https://justine.l...

I was wondering if the author is joking, but after reading a bit more about the attribution drama, it seems rather a lack of reality check and reflection. If you plagiarize work, get called out on it, and then call this "harrassment", I don't know...

Re: Restartable Sequences

#35
post #32

Earlier quoted context omitted.

The author is referring to false sharing ( https://en.wikipedia.org/wiki/False_sharing ). CPU caches operate at cache line granularity (typically 64 bytes) so writes to one part of the cache line can require synchronization with writes to non-overlapping parts of the same cache line. This can dramatically reduce performance when there are a large number of cores operating on the same cache line. If you remove the 64…

Thanks for the effort but the q wasn't "what is false sharing", The Q is: is it true the CPU mutexes are actually slower than those implemented in userspace?

The "CPU mutex" is just the cache coherency mechanism. If you shard your data to avoid triggering it as suggested, then yes, it's much faster.

EDIT: or maybe you're asking if introducing an explicit userspace mutex is better than a lockless algorithm with false sharing issues. The answer is that it's workload dependent but it definitely can be.

Re: Restartable Sequences

#36

Earlier quoted context omitted.

The author was also asking for money to buy a house in SF and travel on private planes like a few days ago..the donation must have really showed up if they are using 20k machines at home.

She bought the workstation at a discount (see bottom of TFA). Also, it was pre-2025 (before she got her job at Gradient Canopy), so long before asking for donations. Finally, if you read the actual donation request, you can see she is trying to make a living doing open source, and is being honest about what the money is going to. Why is that an issue?

There's quite a bit of a spectrum between "trying to make a living doing open source" and "asking for people to pay for a house in one of the most expensive cities in the country - plus a private jet. It's also quite grating to see it written like we should be grateful that we are even allowed to donate to her.

And if she's even half the genius she's claiming to be, why aren't the big tech companies in a bidding war over who get to pay her a million-dollar salary?

From what I've read of her in the past she seems to be a pretty damn good developer. But in the open source world those are a dime a dozen. If you want to make a living off of it you've got to market yourself, and this... isn't how you do that.

Re: Restartable Sequences

#37

> chances are the CPU's internal mutexes aren't as good as the ones you've implemented in userspace Anyone with an informed opinion on this statement? It's seems counter intuitive (npi).

[deleted]

Re: Restartable Sequences

#38
post #35

Earlier quoted context omitted.

Thanks for the effort but the q wasn't "what is false sharing", The Q is: is it true the CPU mutexes are actually slower than those implemented in userspace?

The "CPU mutex" is just the cache coherency mechanism. If you shard your data to avoid triggering it as suggested, then yes, it's much faster. EDIT: or maybe you're asking if introducing an explicit userspace mutex is better than a lockless algorithm with false sharing issues. The answer is that it's workload dependent but it definitely can be.

Let's try this again:

OP > The issue is this will likely go just as slow if not slower. The mere act of sharing the same 64-byte region of memory (a.k.a. cacheline) between multiple cores, causes the CPU internally to basically use a mutex, and chances are the CPU's internal mutexes aren't as good as the ones you've implemented in userspace.

The claim by OP is that "chances are" that userspace mutexes are better than CPU's internal mutexes. So either h/w guys are (for a first) lagging s/w folks and using outdated approaches to creating a mutex in hardware, OR, we somehow must use an inferior approach when implementing a mutex in a CPU, OR, ..

How is it possible that a hardware implementation of an algorithm could be slower than its software variant, and that in "userspace" and not even the kernel.

Re: Restartable Sequences

#40
post #36

Earlier quoted context omitted.

She bought the workstation at a discount (see bottom of TFA). Also, it was pre-2025 (before she got her job at Gradient Canopy), so long before asking for donations. Finally, if you read the actual donation request, you can see she is trying to make a living doing open source, and is being honest about what the money is going to. Why is that an issue?

There's quite a bit of a spectrum between "trying to make a living doing open source" and "asking for people to pay for a house in one of the most expensive cities in the country - plus a private jet . It's also quite grating to see it written like we should be grateful that we are even allowed to donate to her. And if she's even half the genius she's claiming to be, why aren't the big tech companies in a bidding war…

> From what I've read of her in the past she seems to be a pretty damn good developer. But in the open source world those are a dime a dozen

Not exactly. Very few people in recent decades have achieved anything comparable to αcτµαlly pδrταblε εxεcµταblε and Cosmopolitan libc - they're in the category of "that should not even be possible". Of course, Tunney's work doesn't touch Fabrice Bellard in terms of sheer breadth and impact, but they're arguably in the same category.

Post reply on HN