News for hackers. Stuff that matters.
Re:Upgradable Read Write Lock for Go by greatgib on Friday October 27, 2023 @06:42AM (#38036858)
This upgradable RW lock looks fundamentally broken in my opinion:

If you use such a lock, it is because you want to write something based on data that you read.

And nothing should change the date after your calculus and before the write.

But if you use 2 of such upgradable RW lock concurrently at the same time: Both will read the original data, and so calculate something based on that, and they will just wait one after another to write. But the second one will not notice and recalculate after the first write, or you will have a deadlock...

Re:Upgradable Read Write Lock for Go by danbulant on Friday October 27, 2023 @07:14AM (#38037066)
In the post they mentioned that there can only be a single upgradeable read to prevent this.
Re:Upgradable Read Write Lock for Go by sancar on Friday October 27, 2023 @08:11AM (#38037446)
Yes, exactly. Thanks danbulant for reading the blog :)