`
hanhg
  • 浏览: 133286 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

What’s dead lock? What will cause dead lock and ho

阅读更多
 A deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does.
 A program probably causes deadlock between two threads that are both trying to acquire locks for the same two resources.
 To avoid this sort of deadlock when locking multiple resources, all threads should always acquire their locks in the same order.
Thread 1 locked resource1, and won't release it 'till it gets a lock on
    resource2.  This thread2 holds the lock on resource2, and won't
    release it 'till it gets resource1.  We're at an impasse. Neither  thread can run, and the program freezes up.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics