Linux 中的页表
问题 1:- 在引导过程中,Linux 创建页表。然而,当一个新进程执行时,它也有自己的页表。这两个表有何不同?
问题 2:- 在 x86 架构上,Linux 使用明确定义的方案(包括页目录、页表条目等)将线性地址转换为物理地址。 假设我们在进程地址空间 A 中有一个线性地址 X,当使用页表进行转换时,该地址对应于物理地址 Y。还有一些其他进程 B 也具有属于其自己的地址空间的有效线性地址 X。现在如果进程B想要访问X,X会再次对应同一个物理地址Y吗?
Question 1 :- During the booting process, Linux creates the page tables. However, when a new process is executed, it also has its own page table. How are these two tables different?
Question 2 :- On x86 arch, Linux uses a well defined scheme (which includes Page directory, page table entries and likewise) to translate the linear address to physical address.
Suppose we have a linear address X in the process address space A which when translated using the page tables corresponds to physical address Y. There is some other process B which also has valid linear address X belonging to its own address space. Now if process B wants to access X, would X once again corresponds to the same physical address Y?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题 1:页表不仅仅在启动时创建。每次进程分叉时都会创建一个新的页表。新表遵循内核在启动时设置的模板,但每个表都是独立的数据结构,可以根据进程进行更改。它们通常有所不同,允许每个进程拥有自己的工作内存,只有它可以访问。
问题 2: 不,这种行为是首先使用分页的原因之一。
Question 1: Page tables aren't created only at boot. A new page table is created every time a processes is forked. The new tables follow a template set up by the kernel at boot, but each is an independent data structure that can change per-process. They generally differ to allow each process to have its own working memory that only it can access.
Question 2: No, and this behavior is one of the reasons paging is used in the first place.
问题1:他们的权限不同。
问题 2:不。
如果您真的很好奇,而不仅仅是为作业寻找简单的答案,您可能也想看看这个:http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory
Question 1: Their permissions are different.
Question 2: No.
You might want to check this out too, if you're really curious and not just looking for easy answers for your homework: http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory