Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why one page table per process

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

like image 847
user308553 Avatar asked Nov 29 '11 02:11

user308553


People also ask

Why does each process need its own page table?

Having a separate page table for each process is necessary for process isolation as they should not be allowed to stomp on each others memory. Since each process has a different page table, there is not one pmap that will work for every process.

Can a process have more than one page table?

Yes, some systems use multiple page tables. On the VAX, e.g., each process has three page tables.

Does each process has a page table?

Yes every process has its own pagetables. They might be shared with the parent process(copy on write) or with other processes(shared memory).

How many page table entries are required per process?

The page table needs one entry per page. Assuming a 4GB (2^32 byte) virtual and physical address space and a page size of 4kB (2^12 bytes), we see that the the 2^32 byte address space must be split into 2^20 pages. This means the page table must have 2^20 entries.


1 Answers

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.

like image 191
Alexey Frunze Avatar answered Sep 21 '22 09:09

Alexey Frunze