Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Memory Management Ideas

jhaberstro edited this page Mar 24, 2013 · 3 revisions

So, there's basically several layers of the memory management system:

  1. 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..)

  2. 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.

  3. 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).

Clone this wiki locally