Previous | Next --- Slide 7 of 66
Back to Lecture Thumbnails
ckk

Deadlock happens in example 1 because workerA can't add a job to the queue of worker B. Likewise workerB. Deadlock happens in example 2 because all threads try to send messages at the same time, while no one receives any of the messages sent by other threads

aman0456

The example to the right should seem familiar from the lecture we had on the message passing model. To recollect, we saw a deadlock there when all threads were sending messages to some other thread, then waiting in a blocking fashion to receive an acknowledgement from the receiver thread. The solution we had discussed to avoid that is that we designate some threads as senders and some as receivers instead of all threads acting as both.

Please log in to leave a comment.