A special type of error that is related to multi- tasking is deadlock, which occurs when two threads have a circular dependency on a pair of synchronized objects. Suppose one thread enters the monitor on object X and another thread enters the monitor on object Y, it will block as expected. However if the thread in Y , in turn tries to carry any synchronized method on X the thread waits forever, because to access X it would have to release its own lock on Y so that the first thread could complete. Deadlock is difficult error to debug.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment