How to explain the “deadlock” better?

前端 未结 15 1035
不知归路
不知归路 2020-12-13 00:52

I am struggling to explain \"deadlock\" in threads in easy words, so please help. What could be the best example of \"deadlock\" (say, in Java), and how it does happen in st

15条回答
  •  孤街浪徒
    2020-12-13 01:11

    Usually the classes of concurrent programming explains deadlock by examples. I think that the problem of the Dining Philosophers will be a good example to use. You can develop this example in Java and explain the occurrence of deadlock when two philosophers holds a left fork and are waiting for the right fork. (or vice versa).

    I learned a lot of concepts from concurrent programming using this examples implemented on Java.

提交回复
热议问题