-
Notifications
You must be signed in to change notification settings - Fork 0
Memory Management Ideas
So, there's basically several layers of the memory management system:
-
The Physical Memory Manager: This is the lowest level. It essentially keeps track of how much physical memory is available. At startup, the kernel knows where all of the unused memory starts and ends because it also knows exactly how much space the kernel itself uses. The PMM just operates within this range. This is all ready implemented by Xinu; see system/memget.c and system/memfree.c. I believe the common terminology is that the PMM is used to allocate frames (however, it also common for people to just refer to these as pages as well, but I find that confusing since an OS can have a PMM that allocates frames, but not using paging for their virtual memory scheme). It might be a fun project to reimplement the allocation scheme to use a more common/robust scheme (such as slab, buddy, etc..)
-
The Virtual Memory Manager: This sits above the physical memory manager and it is responsible for mapping and unmapping (physical) frames into (virtual) pages. I.E. this would be the interface to the MMU.
-
Heap/Malloc: Our highest level, that uses both the PMM and VMM. Essentially malloc is responsible for partitioning and allocating out the virtual address space by requesting frames from the PMM, mapping frames to pages with the VMM, and keeping track of (each process's(?)) used pages. How this layer manages the virtual address space is similar to how the PMM manages the physical address space.
I'm still investigating how this fits into processes exactly (for example, there's a "memlist" field in the process/thread structure that I'm wondering if we can use to keep track of each processes allocated pages).