Mozo40 wrote:
Hi everyone,
I am going to develop PMM & VMM for my OS.
I read the documents in the wiki and some tutorials but i think that i didn't understand the main idea.
I want to understand how to make the PMM, the VMM and what is the address spaces.
I read a lot of documents about this but no document described how to develop one , they talk about the allocators and how malloc and free works.
Can anyone explains to me how the PMM and VMM work and what is the address spaces, please?
------------------
Thanks in advance.
At its simplest, a physical memory manager maintains a bitmap of the memory which is currently being used. At the request of the kernel it will search the bitmap for the required number of contiguos (usually 4096 byte) pages, and then pass their address to the kernel. When the kernel later releases that memory, the physical memory manager will go to the bitmap and mark the pages as available for reuse. Depending upon how much information you want to record, the "bitmap" may or may not have a single bit for each page, indicating it as in use/not in use.
A virtual memory manager is a bit more complicated, but it relies upon the physical memory manager to allocate physical memory, which it then maps to the virtual memory applications work with (although they "think" the addresses they work with refer to physical memory).