Hacker News new | ask | show | jobs
by titzer 300 days ago
> Also it seems that it requires locking? That's not very good given that locks often need syscalls.

AFAIU in most STMs all the fast paths are implemented using lock-free algorithms with just barriers.

1 comments

How do you implement "commit" part safely (writing changes to the object) without locking the object?
One way is that the writer thread prepares a completely new copy of the object in a private area and then either compare-and-swaps a pointer to it, or executes a store with a store-store barrier (depending on details of the STM system around it).
Interesting, it's almost like immutable data structures.