Pergunta de entrevista da empresa Amazon

What is deadlock

Respostas da entrevista

Sigiloso

2 de jun. de 2011

In simple terms, a deadlock occurs when two threads each lock a different variable at the same time and then try to lock the variable that the other thread already locked. As a result, each thread stops executing and waits for the other thread to release the variable. Because each thread is holding the variable that the other thread wants, nothing occurs, and the threads remain deadlocked.

2

Sigiloso

24 de jul. de 2011

I faced a situation at work when our code after opening a DB connection was getting into exception without closing the DB connection. Under high load the number of requests for DB connections were too much and could not wait for DB to timeout stale connections. Result was DB locks

1