How do people handle the fact that the Page Directory + all Tables use 4MB of RAM?
From what I have read, the page directory and all associated tables must be in physical memory at all times. Obviously unused pages dont need to exist.
Does this mean, that if you allocate all 4GB of virtual memory that there will be a 4MB footprint of page tables and page directory?
Page Directory/Table Size
RE:Page Directory/Table Size
You dont need to fill all the tables, you can set present bit in PD to 0.
If you`ll have 4GB of ram 4mbytes wont be much..
If you`ll have 4GB of ram 4mbytes wont be much..
RE:Page Directory/Table Size
"Does this mean, that if you allocate all 4GB of virtual memory that there will be a 4MB footprint of page tables and page directory?"
No. As ccc said, you don't have to have all page-tables present. But really, it doesn't have to leave any kind of footprint of any size on the (virtual) memory available to the process. Remember addresses of page tables and directories are physical addresses, not virtual addresses. You don't have to map them into your virtual memory space if you don't want to. Some people like to though, because it makes it easier to alter them.
No. As ccc said, you don't have to have all page-tables present. But really, it doesn't have to leave any kind of footprint of any size on the (virtual) memory available to the process. Remember addresses of page tables and directories are physical addresses, not virtual addresses. You don't have to map them into your virtual memory space if you don't want to. Some people like to though, because it makes it easier to alter them.
RE:Page Directory/Table Size
Yes, to support a full 4GB of virtual memory, you will need 4MB of page tables to keep track of all of it.
That said, you don't have to support a full 4GB of virtual memory. You can choose to support just 1GB of virtual memory, and you can devote just 1MB to page tables (and any entries in the page directory to tables that cover pages beyond 1GB would just be blank).
Take a look at the size of the swap file in Windows. It almost certainly isn't four gigabytes. It might be only two or three times the size of the amount of RAM installed on your machine.
That said, you don't have to support a full 4GB of virtual memory. You can choose to support just 1GB of virtual memory, and you can devote just 1MB to page tables (and any entries in the page directory to tables that cover pages beyond 1GB would just be blank).
Take a look at the size of the swap file in Windows. It almost certainly isn't four gigabytes. It might be only two or three times the size of the amount of RAM installed on your machine.