在什么情况下僵局是一件好事?
有什么例子可以说明死锁何时有益?
What is an example of when a deadlock is beneficial?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有什么例子可以说明死锁何时有益?
What is an example of when a deadlock is beneficial?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
如果您陷入僵局的程序是病毒?
如果你想冻结一个进程,我想那是你唯一应该这样做的时候......哈哈。
If the program you're deadlocking is a virus?
If you want to freeze up a process, I suppose that would be the only time you should do it... lol.
它的好处是它清楚地向您表明您的代码有错误并且您的同步方法需要修改。
It's beneficial in that it clearly demonstrates you that your code is buggy and your synchronization methods need to be revised.
此处 是利用 mysql 中的数据库死锁的示例。
这更像是一种黑客行为,而不是死锁的普遍好处,但这是我遇到的唯一一件事,涉及创建死锁以获得有益的效果,而不是为了训练目的和测试自动检测方法(有些人可能认为这两者都是)有益,但其好处来自于帮助避免未来的僵局,因此它们的好处与在实验室中研究致命疾病的好处是一样的)。
here is an example of exploiting a db deadlock in mysql.
It's more of a hack than a generalizable benefit of deadlocks, but it's the only thing I've ever come across that involves creating a deadlock for a beneficial effect other than for training purposes and for testing automated detection methods (which some may argue are both beneficial but where the benefit comes from helping avoid future deadlocks, so they are beneficial in the same sense as it's beneficial to study a deadly disease in a lab).
僵局永远没有好处。这是程序中的一个大问题,因为它会导致程序在给定情况下冻结!
A deadlock is never beneficial. It is a huge problem in a program, because it causes the program to freeze under given circumstances!
僵局永远没有好处。当一个或多个进程由于无法满足需求而被永远阻塞时,就会发生这种情况。这通常会导致程序看起来冻结,因为除非打破死锁,否则进程将不会继续。必须专门设计程序以避免在所有情况下出现死锁。
A deadlock is never beneficial. It occurs when one or more processes are blocked forever because of requirements that cannot be satisfied. This will usually cause the program to appear to freeze as the processes will not continue unless the deadlock is broken. Programs must be crafted specifically to avoid deadlocks in all cases.