Memory Management
Memory management is a core task of any operating system. The design selected for Unununium is compatible with the 64-bit architecture supported by both Intel and AMD.
From the point of view of the system, memory is allocated in pages of 4KiB. When the system is first instanciated, all the physical memory pages available in the system are added to a FIFO buffer.
The Linear Address space of the system is split into two parts:
- Global Address Space, visible as read-only to all processes (highest supported address bit set to 1)
- Private Address Space, visible as read-only or read-write to the current process only (highest supported address bit set to 0)
When a process request a memory page, the pages are pulled one by one from the buffer, are zero-ed out by the allocator, and mapped to a Linear Address in the Private Address Space of to the requesting process.
The Linear Address assigned to the memory page is always the next available address and continously grows linearly. A process which constantly needs to allocate and deallocate memory blocks would need to pre-allocate some memory pages and perform internal memory management to allocate and de-allocate the memory blocks from the pre-allocated memory pages.
A process can share access to a page of memory by mapping it in the global address space as a read-only page. This can be used by libraries and system functions to extend functionalities into the address range of other executing processes. These requests can also be extended to support multiple pages in a single request.
Technical requirements of the memory manager, must be able to:
- keep track of allocated and available physical memory blocks
- perform the allocation and deallocation of physical memory blocks
- map in the Private Address Space a page or multiple pages (contiguous linear addresses) of memory as read-only or read-write
- map in the Global Address Space a page or multiple pages (contiguous linear addresses) of memory as read-only
- format a physical page of memory with zeroes at allocation
- keep a lock count on individual memory pages
- maintain seperate page tables for each process