What physical memory model should I use?
Posted: Sun Jan 01, 2012 8:34 am
Hi,
I was redesigning my (physical)memory manager. My previous model was a bitmap but after I tried to track a bug and stepped into my code in GDB, I realized it is an insane amount of instructions. So I went back to the drawing board... I though of a stack model but then I couldn't pop a specific address, and it might return false information if a bug frees twice the same page. So I came up with a hybrid model: I would pop an address then pass it through the bitmap check if it is actually free. If I free a page I push the address and clear the bit. This makes it fast, reliable and only 3,12 % bigger than just a stack implantation and it should be allot faster then the bitmap.
So my question is: What do you think do you like it? Do you want to add something? Or should I use a different idea?
Also I've got a second question about my virtual manager. I've got a problem, every time when I allocate a virtual page, I allocate a physical one and then I map it in a table. The problem occurs when that table is full, then I need a new space that is mapped so that I can access it but I can't allocate one... How can I get around this? I solved this by mapping 4MB in the beginning of the initialization , then I can map my pages in that 4 MB region. But I don't like that solution... Has anyone got another idea?
I was redesigning my (physical)memory manager. My previous model was a bitmap but after I tried to track a bug and stepped into my code in GDB, I realized it is an insane amount of instructions. So I went back to the drawing board... I though of a stack model but then I couldn't pop a specific address, and it might return false information if a bug frees twice the same page. So I came up with a hybrid model: I would pop an address then pass it through the bitmap check if it is actually free. If I free a page I push the address and clear the bit. This makes it fast, reliable and only 3,12 % bigger than just a stack implantation and it should be allot faster then the bitmap.
So my question is: What do you think do you like it? Do you want to add something? Or should I use a different idea?
Also I've got a second question about my virtual manager. I've got a problem, every time when I allocate a virtual page, I allocate a physical one and then I map it in a table. The problem occurs when that table is full, then I need a new space that is mapped so that I can access it but I can't allocate one... How can I get around this? I solved this by mapping 4MB in the beginning of the initialization , then I can map my pages in that 4 MB region. But I don't like that solution... Has anyone got another idea?