Considerations when activating paging

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
faresilient
Posts: 1
Joined: Sat Apr 24, 2010 12:36 pm

Considerations when activating paging

Post by faresilient »

I'm trying to activate paging in my operating system. How would I handle paging when I also manage segments? Or should I just do "pure" paging?

In addition, when updating my code to handle paging, what should I consider in terms of making changes? I understand that I have to change how my memory manager returns virtual addresses, but where else should I look? Also, are there any changes with paging that should be handled in terms of how the code checks memory such as looking to an array?

Finally, should the kernel have a page directory/table independent of its own if I choose to have each process keep its own page directory/table?
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Considerations when activating paging

Post by gravaera »

faresilient wrote:I'm trying to activate paging in my operating system. How would I handle paging when I also manage segments? Or should I just do "pure" paging?
Depends. If you're developing for x86-32 only, and you know that you don't intend to try to re-use your code for a more generic kernel later on, or even that you don't intend to re-use the code for x86-64, then by all means, go ahead.
...I understand that I have to change how my memory manager returns virtual addresses
I'm sorry, I didn't quite get this. The way the memory manager returns memory isn't going to change much. Maybe the way you allocate memory, and the process which is undertaken to get this memory in a state that is usable to both the kernel and userspace (virtual->physical mapping of allocated physical memory).
Also, are there any changes with paging that should be handled in terms of how the code checks memory such as looking to an array?
A paging kernel confines itself to a virtual environment, so as long as you back your virtually contiguous memory ranges with physical memory, there should be no difference to the kernel in the way it accesses logically contiguous items.
Finally, should the kernel have a page directory/table independent of its own if I choose to have each process keep its own page directory/table?
That depends on your design, but it is inevitable that certain elements of the kernel would be mapped into each address space. Most kernels actually place themselves within each address space, usually toward the higher addresses. There are many advantages to this approach where speed is concerned, and many advantages to the approach of giving the kernel its own address space, mostly where availability of virtual address space for the kernel's management meta-data for userspace is concerned.

All in all, it's mostly just design.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Post Reply