Page tables in Linux
Question 1 :- During the booting process, Linux creates the page tables. However, when a开发者_如何学C 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?
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.
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
精彩评论