A Final Word on Deadlock

Deadlock is the technical term given to the state where you realize you've completely missed some glitch in your multitasking system that allows some threads to get stuck while simultaneously waiting for each other to wake the other up, generally speaking. An example of this could involve threads A and B and objects X and Y. Thread A obtains object X's monitor, and thread B obtains object Y's monitor. Thread A, while owning object X's monitor, waits for thread B to release its ownership on object Y's monitor. However, thread B, while owning object Y's monitor, then waits for thread A to release its ownership on object X's monitor, resulting in both threads getting stuck. This is an example of deadlock.

Generally speaking, deadlock is something you should always be aware of and take proper precautions to avoid. It's just a matter of properly analyzing the path that your threads can take.



Java 1.4 Game Programming
Java 1.4 Game Programming (Wordware Game and Graphics Library)
ISBN: 1556229631
EAN: 2147483647
Year: 2003
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net