What if I have three memory managers on my system? Splitting the functionality up so that on a different architecture the parts that are implemented differently in hardware can be easily swapped out and the source recompiled without having to have a duplicate of the entire manager as you would if it was all one. Basically have a physical manager, a logical manager and a virtual manager.
Physical manager:
Handles tracking of what 4kb chunks of memory are still available and responds to requests by finding an appropriate one and passing the address back.
Logical manager:
Asks for pages from the physical manager, takes the returned address and maps it in the appropriate page table.
Virtual manager:
Responsible for any page swapping to disk that occurs.
This also means the system would be very flexible in development. I can start off with just a physical and logical manager and the virtual manager can slot in later, and if I decided to create a real-mode version of my OS for some insane reason then I could remove the logical manager and the programs can talk directly to the physical manager.
My one problem with this at the moment is the virtual manager. The others operate relativaly normally (program asks for memory from the logical manager, it passes off to the physical manager, passes back to the logical manager, passes back to the program), but how does the virtual manager run? It could be scheduled in its own thread or something but to be honest I don't know under what circumstances the page swapping logic is run normally.
Any thoughts on this? (including "That's what we all do anyway you f00l!"
