4 ms·
That was my reaction as well. To me, it seems like you cannot take it for granted that the existing locking, adequate for incr, is also adequate for mult. It c
by ip26 5y ago
That was my reaction as well. To me, it seems like you cannot take it for granted that the existing locking, adequate for incr, is also adequate for mult.
It could be that in database circles, nobody ever uses any magic and only very strong locks are employed, and perhaps the candidate is supposed to be aware of this.
- ww520 5y agoYes, I can think of couple ways to do lockless atomic increment/decrement but those won't translate well to multiply. Blindly assuming incr/decr using a generic lock that can cover multi as well without understanding how atomic operation work in the product is asking for trouble down the road.
- ankrgyl 5y agoYou can't take that for granted, but it turns out in practice that memcached does not use atomic add, and so it happens to be straightforward to support multiplication with the same set of locks.
- EdwardDiego 5y agoWhere is that documented? I couldn't find any docs on concurrent writes.
- grog454 5y agoI think the question (as presented) simply doesn't select for this kind of analysis and as long as the asker is aware of that, it's not a problem.