Google Interview Question
Country: United States
Interview Type: Phone Interview
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.
Create a map<Thread, List<Locks>>.
- Dan April 26, 20181) Every time a thread request a lock, it will store the data of itself and the lock in the map
2) Thread A requests a lock 5, it locks the object, and does map.put(ThreadA, List.add(lock5));
3) Thread B requests a lock 3, it locks the object, and does map.put(ThreadB, List.add(lock3));
4) Thread B requests a lock 5, the lock is held
5) Thread A requests a lock 3, the lock is held (deadlock occurred)
Detection: Thread A traverses through Map and sees that Thread B is holding lock 3 and waiting on lock 5 (deadlock detected)
Then we need to execute any deadlock prevention mechanisms like releasing all locks, backing up, and redo request at random time