In very simple way
When two processes are waiting for each other for infinite time It is called deadlock
Interviews3 answers
what is Deadlocks
3 Answers
kanchan setiaPosted Jan 30, 2011, 7:42 PM EST
I think, this problem can be solved by, at first thread1 check status of Y, if Y is locked by another thread (thread2), loop the process: wait for a random interval of time and don't hold lock on X. Check status of X, Y, if both of X and Y are not locked then run thread1.
Long Nguyen ThanhPosted May 19, 2010, 3:23 AM EDT
Deadlock is a famous problem you can avoid simply by careful programming. let us assume that we have two threads, thread 1, and thread 2. Let us assume, as well, that we have two objects, object x, and object y. If thread 1 holds a lock on object x and waits for a lock on object y, and thread 2 holds a lock on object y, and waits for a lock on object x then threads will be waiting forever! and this is what we call a deadlock situation.
Purushottam RathorePosted Nov 8, 2009, 9:20 PM EST
