H:= Interviewers was an OMS guy in GS-Hongkong, bent on breaking the candidate.
Q3: any real application of CAS in your project?
Q3b: why did you choose CAS instead of traditional lock-based? Justify your decision.
%%A: very simple usage scenario .. therefore, we were very sure it was correct and not slower, probably faster . In fact, it was based on published solutions, customized slightly and reviewed within my team.
%%A: In this context, I would make my decisions. Actually my manager liked this kinda new ideas. Users didn’t need to know this level of details.
 uncontended lock acquisition is still slower than CAS
Q3d: how much faster than lock-based?
%%A: I didn’t benchmark. I know it wasn’t slower.
H: but any change is risky
%%A: no. There was no existing codebase to change.
H: but writing new code is a change
%%A: in that case, lock-based solution is also risky.
H: “Not slower” is not a good answer.
%%A: I don’t think I can convince you, but let me try one last time. Suppose my son wants to try a new toy. We know it doesn’t cost more than a familiar toy. We aren’t sure if he would actually keep it, but there’s no harm trying it out.
I said this as a last-ditch effort, since I had all but lost the chance to convince him. So I took a risky sharp turn.
H: but this is production not a toy !
So he was on the hook! What i should have said:
A: No we didn’t roll it out to production without testing. Look at what google lab does.
A: well, my wife went through laser surgery. The surgeon was very experienced and tried a relatively new technique. She was not a guinea pig. Actually the procedure is new but shown to be no worse than the traditional techniques. Basically, we don’t need to do lots of benchmarks to demonstrate a new technique is worth trying. For simple, safe, well-known-yet-new techniques, it’s not always a bad idea to try it on a small sample. Demanding extensive analysis and benchmark is a way to slow down incremental innovations.
A: the CAS technique has been well-researched for decades and tried in many systems. I also used it before.