什么是“辫子”? (注意“R”)

发布于 2024-11-14 12:56:55 字数 450 浏览 1 评论 0原文

听说过很多次死锁,但是多线程编程中的死锁是什么?

更新: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懒猫 2024-11-21 12:56:55

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)

念﹏祤嫣 2024-11-21 12:56:55

当一个进程正在请求资源并且该资源被其他等待进程持有并且该进程永远无法更改其状态时,这种情况称为死锁。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文