Kernel Memory allocation - Conceptual Issues
Posted: Wed Oct 04, 2006 11:59 pm
I'm having some conceptual problems with memory management in the kernel.
I've been looking through a number of people's sources to see how they've tackled the problem and although there is obviously no one way in which to implement things. I have noticed that all the sources I have seen so far have a seperate paging system for user land programs and heap allocator for kernel space. Why is this?
It would seem obvious to me that if you have paging set up (and for higher half kernels this is of course a necessity) you would be as well using that for the kernel and for the users programs. However as it's clear that this is not "the done thing" there must be something I'm missing.
So, why do we keep a kernel heap and the page tables seperate? Why not simply request a page or two for the kernel and leave them around for it to play with (presumably they would keep the same memory protection as is available to Userland programs).
Assuming that paging is not the way to go with this, I'm thinking of going with either a doubly linked list or possible a binary tree (with memory chucks sorted by size). Is there a reason to favour one method over another?
The problem with the openess of design choices for Kernel dev seems to be that most everything comes down to personal choice. It might be nice if the Wiki could include tables with pros & cons comparisons of a few methods. Just a thought.
I've been looking through a number of people's sources to see how they've tackled the problem and although there is obviously no one way in which to implement things. I have noticed that all the sources I have seen so far have a seperate paging system for user land programs and heap allocator for kernel space. Why is this?
It would seem obvious to me that if you have paging set up (and for higher half kernels this is of course a necessity) you would be as well using that for the kernel and for the users programs. However as it's clear that this is not "the done thing" there must be something I'm missing.
So, why do we keep a kernel heap and the page tables seperate? Why not simply request a page or two for the kernel and leave them around for it to play with (presumably they would keep the same memory protection as is available to Userland programs).
Assuming that paging is not the way to go with this, I'm thinking of going with either a doubly linked list or possible a binary tree (with memory chucks sorted by size). Is there a reason to favour one method over another?
The problem with the openess of design choices for Kernel dev seems to be that most everything comes down to personal choice. It might be nice if the Wiki could include tables with pros & cons comparisons of a few methods. Just a thought.