Memory Management in Optimix:
Our Memory Manager will have three compoenents
- Physical
- Virtual
- Linear
Physical is initialized first and it is located in a "physHeap" right after the kernel in memory, it provides
two functions (physAlloc() and physFree(unsigned long addr)) they deal with serving up 4KB physical pages of memory.
Paging is initialized next which uses Physical to help map PageTables which are non present and it will free pages
which are being overwritten (If they are found present by the Mapper, it is unmapped then free'd)
Linear is what comes after Paging, it is the "Kernel Memory Manager" since it manages the kernel heap (Virtual)
and is what the C Std Lib "malloc" and friends wrap around.
The good thing about having these three components is they are completely transparent from eachother.
Physical is never used out of Paging (Actually the cool part is we selfmap the Physical heap to the same virt addr, so we can continue to use it for paging even after we enable paging which may be good for things like spawning tasks), Paging is never used
other than spawning/deleting tasks and threads and of course Page faults.
The only thing in the end widely used is the Linear Manager which is the end result after all this shifting and mapping.