
A Simple, Fragmentation-Proof PMM Design
Physical Memory Manager (PMM) Design Document Overview A linked-list based physical memory manager designed for large fragmentation handling. Manages physical memory in contiguous page ranges with self-managing metadata. Node Structure (16 bytes) struct pmm_node { void * base ; // Physical base address (page-aligned) uint32_t count ; // Number of contiguous pages void * next ; // Index of next node in current list uint32_t self_idx ; // This node's own index in metadata page } __attribute__ (( packed )); // 256 nodes per 4K page (4096 / 16 = 256) // Index 0 reserved as null sentinel Runtime Pointers void * free_head ; // Head index of free list void * allocd_head ; // Head index of allocated list void * next_head ; // Head index of free metadata slot list uint32_t nodes_per_page ; // Bytes per page / Node size Three Disjoint Lists free - Tracks all unallocated contiguous page ranges allocd - Tracks all allocated contiguous page ranges next - Tracks free metadata slots (recycling) Invar
Continue reading on Dev.to
Opens in a new tab




