Linux 中的页表

发布于 2024-10-13 14:13:06 字数 243 浏览 7 评论 0原文

问题 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 技术交流群。

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

发布评论

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

评论(2

狂之美人 2024-10-20 14:13:06

问题 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.

唠甜嗑 2024-10-20 14:13:06

问题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

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