Concurrency Freaks covers concurrent algorithms, including wait-free and lock-free data structures, memory reclamation, transactional memory and database isolation.
HN links it for algorithms like Left-Right and Double Instance Locking, and one commenter notes the topic is unfashionable among most HN readers.
And it does so with three links across three paragraphs.
From the QuestDB article:
> First, I found the Double Instance Locking[1] pattern at the amazing Concurrency Freaks blog[2]. This pattern is very similar to the one I described here. It also uses 2 internals structures and readers are alternating between them. It uses a read-write lock to protect the map being mutated. Given there is only a single writer then at any given time there is at least one internal map which is available for reading. This gives readers lock freedom.
> It's fair to say that the Double Instance Locking pattern is simpler to reason about. It decomposes the problem better. But I'd still argue my contribution is the trick with delayed replay of the last operation - if writers are sufficiently rare, then writers won't be blocked at all.
> The same blog also links to the paper Left-Right: A Concurrency Control Technique with Wait-Free Population Oblivious Reads[3] which on the surface also looks similar. It claims not only Lock-Freedom, but also Wait-Freedom. I have yet to deep dive into it.
[1] http://concurrencyfreaks.blogspot.com/2013/11/double-instance-locking.html
[2] http://concurrencyfreaks.blogspot.com/
[3] https://master.dl.sourceforge.net/project/ccfreaks/papers/LeftRight/leftright-extended.pdf?viasf=1
Don't really have an axe to grind regarding strict-serializability, serializability, snapshot isolation or whatever. Start at the highest level of consistency and consciously step away if you encounter issues.
The Postgres default of "Read committed" gives me shivers on the other hand...
> If I were to make a concurrent map data structure whose operations are not linearizable and then put it on a library and give it to my users, any user of that library would come back to me and say that my library has a bug. They may not be able to tell me exactly what it is, but they'll understand that there is a bug in it.
> However, if I take the same concurrent map data structure, and put in an application and call that application a "Key-Value store" or a "Database" (DBMS) and give it to the typical database users, it seems they may certainly use it for a several decades without ever complaining that this "Database" is not linearizable (or serializable as the DB folks call it).
https://concurrencyfreaks.blogspot.com/2020/06/you-say-read-committed-i-say-buggy-code.html
Very much unfashionable for the HN crowd. Most of the new research in concurrency is happening in Java and funded by the high performance trading industry - an industry which is very far from the HN crowd. The new Java8 stampedlock is a good example. It's possible to implement it in C++ as well, but because of the guarantees required by the lock it is a very difficult lock to integrate into C++ code. On the other hand, the JRE guarantees the correct constraints for Java code making a stampedlock very easy to use [1]. The performance of a stampedlock also seems to be the best case for any multi-reader environment. [2]
[1] http://concurrencyfreaks.blogspot.com/2013/11/stampedlocktryoptimisticread-and.html
[2] http://mechanical-sympathy.blogspot.ca/2013/08/lock-based-vs-lock-free-concurrent.html
That's what languages with immutable data structures do. Internally they implement simple data structures (lists, arrays) with more complex ones not to get a performance hit. For example, they don't want to copy every byte every time they add or remove from a list.
In ascending order of complexity
http://theerlangelist.blogspot.com/2013/05/working-with-immutable-data.html
http://concurrencyfreaks.blogspot.com/2013/10/immutable-data-structures-are-not-as.html
http://debasishg.blogspot.com/2010/05/grokking-functional-data-structures.html
In the case of Ruby, it's a language build on mutability so let's use mutable data. There are already plenty of languages with immutable data to use if we want to.
> You may have lock-free code with locks
That doesn't sound right. I suppose you could have locks in the trivial sense, where it never actually blocks, but I don't imagine that's what you meant.
https://concurrencyfreaks.blogspot.com/2013/05/lock-free-and-wait-free-definition-and.html
https://www.cs.yale.edu/homes/aspnes/pinewiki/ObstructionFreedom.html
A very nice approach for read heavy structures is the Left-Right algorithm.
http://concurrencyfreaks.blogspot.com/2013/12/left-right-classical-algorithm.html?m=1
It does cost an extra instance, but it generalizes to any data structure and gives you wait-free reads.