Previous | Next --- Slide 4 of 66
Back to Lecture Thumbnails
qwerty

When does a deadlock occur? It happens when no thread can continue doing its job because it is waiting on another thread to relinquish some shared resource. For example, thread 1 needs a resource that thread 2 is using. Further, thread 2 (which thread 1 is waiting on) is waiting on yet another thread (thread 3) to relinquish another shared resource that thread 2 needs. And thread 2 needs the resource used by thread 3 right now in order to continue executing work that will then allow it to release the resource that thread 1 needs. And this goes on. My understanding is that they are different shared resources (the one that thread 2 has that it's not relinquishing to thread 1 is different from the one that thread 3 is not relinquishing to thread 1) and there's a cyclical nature that causes the deadlock because of different shared resources that are being used by the threads.

Please log in to leave a comment.