Amazon Interview Question for Software Engineer / Developers


Country: United States




Comment hidden because of low score. Click to expand.
3
of 3 vote

Thread dumps can help identify the deadlocks..they include locking information such as which locks are held by each thread, in which stack frame they were acquired, and which lock a blocked thread is waiting to acquire..

To triger a thead dump, you can send the JVM process a SIGQUIT signal, ( kill -3) on unix or Ctrl -Break on windows platforms

- Anonymous March 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Looks like JConsole is one of the famous tool for deadlock detection.

- manish March 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

JConsole ultimately uses the new ThreadMXBean class's methods. One such method is findAllDeadLockedThreads(); This would give the list of threads that are in deadlock. If no dead lock is in plac,e then a null is returned.

This is one way of knowing the information programmatically.

- Pavan Dittakavi March 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Apart from the existing answers , below are few more points that comes to my mind:

1. Look for nested synchronization.
2. Look for the code which is try to acquire another lock while holding one lock .
3.Thread.holdLock(Object) can help to find out whether current thread is holding lock or not.
4. Reentrant Lock gives the list of thread holding its lock

- Vishal April 07, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More