Why one page table per process
Solution 1
A page table usually has a fixed number of entries and therefore describes only a portion of the entire virtual address space. This is why you need multiple of them to cover the entire address space. Now, in many OSes processes have individual (in other words, not shared with others) virtual address spaces, which helps to protect processes from one another. This is another reason for having multiple page tables.
Solution 2
Page table translates from virtual to physical page addresses. Since each process has its own virtual address space and usually maps the same virtual address to a different physical address it needs a separate page table. Curiously, multiple processes may map different virtual addresses to the same physical memory. This can be used to implement shared libraries or inter-process communication.
user308553
Updated on June 19, 2022Comments
-
user308553 about 2 years
At first I thought there is only one page table for the whole system. But there are actually one page table per process? What is the point of having multiple page table instead of one page table.
I am implementing part of os161
-
Ostati about 11 yearsHere's a good explanation as well: en.wikipedia.org/wiki/Virtual_memory#Page_tables
-
smwikipedia over 7 yearsAnd btw, page table is part of the process/task context, when you switch process/task, the page table also needs to get switched.
-
YuGiOhJCJ over 4 yearsAlexey Frunze, this is partially wrong. I agree, a page table has a fixed number of entries. However, I disagree, a page table describes in fact the entire virtual address space for a process. I mean, for each page of the process, you have an entry in its page table. The reason to have multiple page tables is that each process has its own virtual address space, as said by @marski. A page N of a process P1 is probably not mapped to the same frame in physical memory than a page N of a process P2. As there is a specific mapping for each process, you have a specific page table for each process.