How to allocate multiple pages without multiple page tables
Posted: Thu Sep 10, 2020 8:34 pm
Is there any way to allocate multiple pages without a large amount of page tables? I can't think of anyway of doing this,
The Place to Start for Operating System Developers
http://f.osdev.org/
I'm currently porting liballoc, and it need a page map/unmap function. I will also implement multitasking in my os, and multiple programs might run malloc, which will call the page map functions multiple times.Octocontrabass wrote:That's a strange question. Why do you want to do that?
Each page table has 1024 (without PAE) or 512 (with PAE) entries, which covers 4MiB / 2MiB of address space.
Actually I haven't implemented multitasking yet, but I'm definitely going to let programs have its own address space.Octocontrabass wrote:Does each program get its own address space, like a typical OS? If so, memory allocations in one program will not affect the others (as long as you have enough available memory).
Do all programs share a single address space, like some embedded OSes? If so, you'll probably need to determine which program is calling the page map functions in order to allocate memory within that program's portion of the address space.
So long as your mappings are clustered together, the amount of page table memory you'll use per process should be small. A 4K page table will map 4MB of virtual memory, fully utilised. So, if your process is less than 4MB in size, it could occupy only one page table (plus your page directory + kernel mappings,) which isn't very much memory.clementttttttttt wrote:Is there any way to allocate multiple pages without a large amount of page tables? I can't think of anyway of doing this,