Amazon Interview Question
Software Engineer / DevelopersCountry: United States
is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
It's not the case that every thread will have its own separate own copy. The variable is declared static, and so there is just one main copy of the variable, shared among all the instances. The issue here is that unless the variable is declared volatile, a thread may cache a local copy of the variable in a register and not synchronize that copy with the central copy in memory until the next time a synchronized statement occurs. It may also, however, not cache a local copy, or sync the local copy with the main copy any time before that, such as when the thread no longer needs to keep the variable in a register. So the thread will probably eventually see the new value of false, but unless you use a volatile variable or a synchronized block, it might not see it as soon as it's set, and there are no hard guarantees on when exactly it will see it.
- eugene.yarovoi March 18, 2013