是什么导致程序冻结
根据我的编程经验,每当程序出现问题就会崩溃,无论是来自未处理的异常还是一段应该检查错误但没有检查错误的代码。什么会导致程序完全冻结系统以至于需要重新启动。
编辑:感谢您的回答。至于语言和操作系统,这个问题的灵感来自于我玩《辐射》,游戏在一小时内冻结两次,导致我不得不重新启动 xbox,所以我猜测是 c++。
From what experience I have programming whenever a program has a problem it crashes, whether it is from an unhanded exception or a piece of code that should have been checked for errors, but was not and threw one. What would cause a program to completely freeze a system to the point of requiring a restart.
Edit: Thanks for the answers. As for the language and OS this question was inspired by me playing Fallout and the game freezing twice in an hour causing me to have to restart the xbox, so I am guessing c++.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一百万种不同的东西。最常见的问题是:
A million different things. The most common that come to mind are:
在 Dotnet/Java 类型的环境中,控制系统非常困难,因为运行时使您的代码与操作系统保持一定距离。
更接近金属,比如 C 或 C++、汇编等,你必须公平地对待系统的其余部分 - 如果你没有它,已经获取 Petzold 的副本,并用“样板”代码的数量进行观察/实验,以获得一个单一窗口运行...
甚至更接近,在驱动程序级别,各种事情都可能发生...
In a Dotnet/Java type environment its quite difficult to seize a system up, because the Runtime keeps you code at a distance from the OS.
Closer to the metal say C or C++, Assembly etc you have to play fair with the rest of the system - If you dont have it already grab a copy of Petzold and observe/experiment yourself with the amount of 'boilerplate' code to get a single Window running...
Even closer, down at the driver level all sorts of things can happen...
导致应用程序死锁的原因有很多,无论是内部还是外部,更常见的情况是当程序请求某些内容但没有给出时,会导致无限等待,实际的例子是,程序编写了一些文本到文件,但是当它要打开文件进行写入时,任何其他应用程序都会打开同一个文件,因此请求应用程序将等待(如果编码不正确,在某些情况下会冻结),直到它获得文件的独占控制权。
当所请求的文件对于操作系统非常重要时,会导致系统重新启动的严重冻结。但是,您可能不需要重新启动系统即可使其恢复正常,除非被冻结的程序是用生成本机二进制文件的语言(准确地说是 C/C++)编写的。因此,如果应用程序是用一种支持托管代码概念的语言(如任何 .NET 语言)编写的,则不需要重新启动系统即可使一切恢复正常。
There are number of reasons, being internal or external that leads to deadlocked application, more general case is when something is being asked for by a program but is not given that leads to infinite waiting, the practical example to this is, a program writes some text to a file, but when it is about to open a file for writing, same file is opened by any other application, so the requesting app will wait (freeze in some cases if not coded properly) until it gets exclusive control of the file.
And a critical freeze that leads to restarting the system is when the file which is asked for is something which very important for the OS. However, you may not need to restart the system in order to get it back to normal, unless the program which was frozen is written in a language that produces native binary, i.e. C/C++ to be precise. So if application is written in a language which works with the concept of managed code, like any .NET language, it will not need a system restart to get things back to normal.
页面错误、尝试访问无法访问的数据或内存(访问冲突)、不兼容的数据类型等。
page faults, trying to access inaccessible data or memory(acces violation), incompatible data types etc.