什么是“辫子”? (注意“R”)
听说过很多次死锁,但是多线程编程中的死锁是什么?
更新: IAbstract 的答案链接一份白皮书解释了名为dreadlock的算法(看起来不是产品)。它相当彻底地涵盖了这个概念。不过,简单总结一下它的含义:
检测死锁的常见方法是跟踪哪些线程正在锁定哪些资源。这基本上会产生一个线程到资源图,当该图中出现循环时,就会发生死锁。这种方法被称为自旋锁,并且也因其昂贵而闻名,因此也通常使用更有效的替代方案,例如简单的锁定超时。通过最小化跟踪锁定周期所需的数据量,Dreadlock 算法似乎是解决常规自旋锁算法低效问题的解决方案。
Heard many times of deadlocks, but what is a dreadlock in the context of multithreaded programming?
Update: IAbstract's answer links to a whitepaper which explains the algorithm named dreadlock (not a product it seems). It covers the concept quite thoroughly. However, to briefly summarize what it's about:
A common way of detecting deadlocks is to keep track of which threads are locking which resources. This basically produces a thread-to-resource graph, and when a cycle appears in this graph a deadlock has occurred. This method is known as a spin-lock and is also known for being expensive, so more efficient alternatives like simple locking-timeouts is also commonly used. The Dreadlock algorithm seems to be a solution for the inneffectiveness in regular spin-lock algorithms, by minimizing the amount of data needed to keep track of locking cycles.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Dreadlock 看起来像是一个新产品或工具集,您可以用于查找或检测死锁(尽管,当发生死锁时,您会咒骂可怕的死锁)。 (链接由菲利克斯·克林提供)
Dreadlock looks like a new product or toolset you can use to find or detect deadlocks (although, by the time one occurs, you will be cursing the dreaded deadlock). (link supplied by Felix Kling)
当一个进程正在请求资源并且该资源被其他等待进程持有并且该进程永远无法更改其状态时,这种情况称为死锁。
when a process is requesting for a resource and that resource is held by some other waiting process and the process is never able to change it's state, the situation is called as deadlock.