操作系统中的页面错误处理程序在哪个堆栈上运行 [英] Which stack does the page fault handler in an operating system run on

查看:95
本文介绍了操作系统中的页面错误处理程序在哪个堆栈上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不久前我问了类似的问题,但我可能措词不正确.因此,如果进程A正在运行,并且在内存中的位置4000处导致了页面错误,那么这将导致页面错误.执行将转移到内核.那么页面错误处理程序将在哪个堆栈上运行?这是在内核的虚拟地址空间中吗?还是为所有此类中断保留了堆栈空间?

I asked a similar question a little while ago but I may have not worded it correctly. So if process A is running and it causes a page fault at location 4000 in memory, and that causes a page fault. Execution will be transferred to the kernel. Then which stack will the page fault handler run on? Is this in the virtual address space of the kernel? Or is stack space reserved for all interrupts of this sort?

推荐答案

Linux并不在乎您是在运行C还是C ++程序.

Linux doesn't care whether you're running a C or C++ program, really.

当CPU检测到错误的地址时,它将引发一个中断.没有合理的方法来使用用户堆栈,因为它可能处于完全损坏的状态.内核有自己的专用堆栈来处理这种严重的错误.

When the CPU detects a faulty address, it raises an interrupt. There's no reasonable way to use the user stack, as it may be in a totally corrupt state. The kernel has its own private stack for this kind of serious faults.

并非普遍如此.如果您通常调用内核来为您做事,则内核可能会假设您有一个合理的堆栈.

This isn't universally the case. If you normally call the kernel to do things for you, the kernel may assume that you have a reasonable stack available.

这篇关于操作系统中的页面错误处理程序在哪个堆栈上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆