81 karma · joined October 18, 2013
https://github.com/ademakov
- I have a TATAS lock implementation elsewhere: https://github.com/ademakov/MainMemory/blob/master/src/base/...
Could add it to Evenk as well.
- Exchanged value in FutexLock is not discarded, it is used in the conditions of the `if` and `while` statements. In both cases the returned value of 0 means that we've got the lock and the next thing executed will be the `break` statement. If either value of 1 or 2 is returned then we need to proceed with spinning. The `if` condition relies on short-circuiting of || operator, so the exchange is only done if the `value` variable is equal to 1. If it were equal to 0 then the CAS in the for loop would have returned true leading to an early exit.
The idea of using backoff before futex is picked from this article: http://locklessinc.com/articles/mutex_cv_futex/
The author suggests to spin a little in unlock as well, but I didn't go that far.
https://en.wikipedia.org/wiki/Leonid_Kantorovich
He received Nobel prize and (horror!) Stalin prize for his work in mathematics and using mathematics for evil planning of economic programs.
http://en.wikipedia.org/wiki/Sergey_Alexeyevich_Lebedev
On the other hand it does not mention von Neumann either, it talks about Norbert Wiener, whose theories have doubtful contribution to computer science. The critical articles about his theories in Soviet media were pretty ridiculous, but hardly had any effect on the development of computers or control theory in SU. The author mentions nobody else relevant to the subject:
https://en.wikipedia.org/wiki/Andrey_Ershov https://en.wikipedia.org/wiki/Georgy_Adelson-Velsky https://en.wikipedia.org/wiki/Alexey_Lyapunov https://ru.wikipedia.org/wiki/%D0%9F%D0%BE%D1%81%D0%BF%D0%B5...
Perhaps the author took inspiration for his article from the worst examples of Soviet propaganda. Twisting the facts, mixing them with fiction in such a way that is hard to tell one from another.
https://github.com/ademakov/MainMemory
Though it's not a library, but it can be converted into one if needed. And it's not so lightweight already and I'm still working on more features.