Hacker News new | ask | show | jobs
by greatgib 973 days ago
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...

1 comments

In the post they mentioned that there can only be a single upgradeable read to prevent this.
Yes, exactly. Thanks danbulant for reading the blog :)