如果我在 Cygwin 中出现段错误,会产生什么影响?

发布于 2024-11-24 03:02:18 字数 154 浏览 2 评论 0原文

我正在 Cygwin 上使用 emacs 学习 C++,我听说在较旧的 Unix 操作系统中,段错误可以完全破坏关键内存。我知道 Cygwin 的一个想法是让 Windows 更像 Unix,所以如果我在 Cygwin 上遇到段错误,这会损坏 Windows 或 Cygwin 上的任何东西吗?

I am learning C++ using emacs on Cygwin, and I heard that in older Unix operating systems, a segfault can completely destroy critical memory. I know one idea with Cygwin was to make Windows more like Unix, so if I get a segfault on Cygwin, will that damage anything on Windows or Cygwin?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

酒几许 2024-12-01 03:02:19

在现代操作系统(包括 Linux、Win2K+ 和 MacOSX)中,每个进程只能访问由操作系统管理的“虚拟内存”区域,并在进程生命周期结束后完全清除。导致进程终止的进程部分内存访问错误仅仅意味着该进程已尝试访问其虚拟地址空间的一部分,但它尚未通知操作系统并且操作系统不希望进程访问该空间,但这不会影响该进程之外的任何内容。用户空间进程无法直接访问“真实”内存,因此您无法真正造成巨大的损害。

(好吧,我在掩盖一些事情,如果您不小心触发了 API 调用“kill”并且您拥有管理员权限,我想您可能会造成一些伤害。但您知道我的意思。)

In modern operating systems (which include Linux, Win2K+ and MacOSX), every process can only access an area of "virtual memory" which is managed by the OS and cleaned up entirely after the process's lifetime finishes. A memory access error on part of the process that causes the process to be terminated simply means that the process has tried to access part of its virtual address space which it has not informed the OS about and which the OS did not want to process to access, but this does not affect anything outside that one process. There is no direct access to "real" memory for userspace processes, and thus you cannot really do a huge amount of harm.

(OK, I'm glossing over things, if you accidentally triggered an API call to "kill" and you had admin privileges, I suppose you could cause some harm. But you know what I mean.)

倚栏听风 2024-12-01 03:02:18

不,它不会损坏任何东西。它只会导致触发段错误的应用程序崩溃。并且可能(取决于您的 Windows 版本和设置)您会收到一条恼人的弹出消息,通知您崩溃,并询问您是否要报告它。

No, it won't damage anything. It will just cause the application that triggered the segfault to crash. And probably (depending upon your Windows version and settings) you'll get an annoying popup message informing you of the crash, and asking if you want to report it.

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