Page 1 of 1

need help for startup with my memmory manager

Posted: Sat Dec 15, 2007 2:44 pm
by bsunisol
hi there,
i have an idea of how to code my MM.
i will do it with a list of ram which is used and not.
but this list needs ram for it self.
i dont know how many of ram i should reserve for
this list or if there is a way to do that dynamicly....

some hints?


thanks.
Uni_Sol

Posted: Sun Dec 16, 2007 4:46 am
by hailstorm
You could start by finding out how many memory the system has. Based on that number and your smallest allocation block, you can decide how large your list should be. For example, you can decide yo use 4K as smallest allocation unit (page frame size on the i386). Calculating how large that list of yours is would be:

List_size = (sys_mem_in_bytes / 4096) * sizeof(list_unit)

or something like this...

succes!

Posted: Sat Dec 22, 2007 11:41 am
by frank
I put my bitmap immediately after the end of the kernel in memory. My bitmap is sized based on how much memory there is present in the system. Just make sure that you mark the bitmap/stack/whatever you use to keep track of memory as used.

Posted: Sat Dec 22, 2007 12:25 pm
by jerryleecooper
im doing that myself. Im using an array defined in the stack as its first array. the last item point to the next array, which is allocated by one item in the array.

Posted: Sat Dec 22, 2007 2:13 pm
by Telgin
Yeah, from what I understand the best way to do it is to just put the memory management information (bitmap, or what have you) at a specific address in memory that you will make a conscious effort to not stamp on. If you know the size already, this isn't too hard (just do the math before hand, if you know how much RAM is in the machine you should be able to figure out how much book keeping information is necessary, such as the size of the bitmap).

Posted: Sun Dec 23, 2007 7:07 am
by bsunisol
thanks guys