Hacker News new | past | comments | ask | show | jobs | submit login

I presume that the poster did not get the job. The correct answer is that while addition and subtraction are mutually order independent addition and multiplication are not. This cannot be implemented for a value that allows addition. You need to create a new type of value "multiplyable" and implement multiplication only for that new special type of int. Otherwise you'll end up with meaningless race conditions in the case,of multiple clients.



Congratulations, you have qualified as a Type 1 candidate and did not get the job.

"and the whole thing needs to be atomic. Let’s look at how the locking works…” They spend all three hours getting deeper and deeper down various rabbit holes, and never produce anything that works. Candidates in this group don’t get hired."


Actually, I know how to communicate and would explain the problem to them.


Also, locking wouldn't help with this as even that wouldn't fix the fundamental design issue.


I actually can't tell whether you're serious...

The article mentions an `append` operation which is obviously not commutative; does that imply memcached needs a separate "appendable" string type? Of course not. Memcached only guarantees that the individual operations are atomic, it's the client's responsibility to avoid race conditions between multiple operations.


Yeah, um, there's a difference between "the client" and "multiple clients". Multiple clients racing can't be fixed.

I begin to wonder about this programming culture. Speed at generating LOC, doesn't necessarily have to work IRL...


> Multiple clients racing can't be fixed.

Really? You can't think of a single way for multiple clients to operate on the same data without racing? (Here's a hint if you're still having trouble: https://github.com/memcached/memcached/wiki/Commands#cas.)


Now to in order to multiply a sequence of numbers correctly in a "high performance" shared store, you have external process synchronization. Just awesome. Thank you for the lesson. I had no idea concurrent processing could be so easy.


I don't even think this is a valid criticism, as memcached has set, replace, and delete, which exhibit the same order-dependent behavior.

I don't think memcache guarantees anything other than operations are atomic.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: