VMM idea.
Posted: Fri Aug 11, 2006 3:22 pm
Hey people!
Its Me again, the never sleeping caffieneaholic Zeii!
(aka, word slaughterer)
Anywho, Ive been working on a concept for a VMM / Block Allocator.
And, Ive decided on this.
PMM - Allocates Pages, Returns Physical Address that the page addresses.
VMM - Maps the Page as a 4kb Block, all allocations work there, until the 4kb is used or ABOUT to be used up, in which case the VMM orders PMM to allocate another page, which is then added to the VMM Block list as another 4kb block.
Anywho, for the Block Manager, Im going to use a Binary Search tree.
you know, Something greater than a node, will link onto the RightNode Pointer, something less than a node will link onto thoe LeftNode pointer.
I will keep track of the BlockSize, the BlockAddress and a Flag.
(I will optimize this to take only one variable in the future, when my idea is working. )
Anywho, This is my plan...
I will order the Tree by Address.
When the VMM Initializes, it allocates a page, a 4kb 'heap' is active.
So, we Have a 4kb 'block-node', with starting address of wherever the Block actually exists.
Say we want to allocate 1kb?
First of all, we half the 4kb block. Size = Size / 2, then we add a 2kb block to the Tree. The 2kb block address is the previous block plus previou sblock size.
2048
0x000
F= FREE
\
2048
0x800
F= FREE
We will always split the lowest address first, IF it is greater than the size to be allocated.
For 1kb, we need to split 2048.
We half the 2048 block.
And add a 1024 block, address = previousblockaddr + previousblocksize
1024
0x000
F=FREE
\
2048
0x800
F=FREE
/
1024
0x400
F=FREE
No we have a 1024 block, that we can use!
We set the Root block (1024) Flag to USED and return the Address as a pointer. Then we have memory that can be used, YAY!
Now what happens when we free that 1024b block?
We will want to Merge all the free blocks!
But, Since we cant really 'delete' a Node, since there is no Delete system in place, We will have to store what nodes arent 'existant' anymore.
POST 1
Its Me again, the never sleeping caffieneaholic Zeii!
(aka, word slaughterer)
Anywho, Ive been working on a concept for a VMM / Block Allocator.
And, Ive decided on this.
PMM - Allocates Pages, Returns Physical Address that the page addresses.
VMM - Maps the Page as a 4kb Block, all allocations work there, until the 4kb is used or ABOUT to be used up, in which case the VMM orders PMM to allocate another page, which is then added to the VMM Block list as another 4kb block.
Anywho, for the Block Manager, Im going to use a Binary Search tree.
you know, Something greater than a node, will link onto the RightNode Pointer, something less than a node will link onto thoe LeftNode pointer.
I will keep track of the BlockSize, the BlockAddress and a Flag.
(I will optimize this to take only one variable in the future, when my idea is working. )
Anywho, This is my plan...
I will order the Tree by Address.
When the VMM Initializes, it allocates a page, a 4kb 'heap' is active.
So, we Have a 4kb 'block-node', with starting address of wherever the Block actually exists.
Say we want to allocate 1kb?
First of all, we half the 4kb block. Size = Size / 2, then we add a 2kb block to the Tree. The 2kb block address is the previous block plus previou sblock size.
2048
0x000
F= FREE
\
2048
0x800
F= FREE
We will always split the lowest address first, IF it is greater than the size to be allocated.
For 1kb, we need to split 2048.
We half the 2048 block.
And add a 1024 block, address = previousblockaddr + previousblocksize
1024
0x000
F=FREE
\
2048
0x800
F=FREE
/
1024
0x400
F=FREE
No we have a 1024 block, that we can use!
We set the Root block (1024) Flag to USED and return the Address as a pointer. Then we have memory that can be used, YAY!
Now what happens when we free that 1024b block?
We will want to Merge all the free blocks!
But, Since we cant really 'delete' a Node, since there is no Delete system in place, We will have to store what nodes arent 'existant' anymore.
POST 1