Wednesday, December 24, 2008

Deadlock

While synchronizing two or more threads, care should be taken to ensure that they don’t create a deadlock situation. This happens when one thread wais for a second thread to pass control, but the second thread in turn waits for the first thread to pass control. When this happens, program execution will simply halt. This situation is called as deadlock. One way to avoid deadlock situation is by making one of the thread to release control for a short time, so that the other synchronized thread can access the common object.

No comments: