Problems completely understanding memory management.
Posted: Sun Aug 12, 2012 9:30 am
Not again. I hate violating some kind of unspoken forum etiquette, but I'm kinda racking my brains about this.
I can't find a concrete tutorial or article that explains, in a concrete and complete manner (with or without code examples, I think I'll be fine) about memory management, from physical, to paging, then the heap.
A bunch of questions:
1. What does it mean by 'A stack expands downwards'? Can somebody explain, using concrete memory addresses to me?
2. How is physical memory management done? I think it's something along the lines of simply keeping track of what you can and cannot use, splitting up that memory and passing pointers around?
3. I mostly get paging… *mostly*. I get the part where there's an address in memory, and you apply these flags to it… Like (Taken from the James Molloy tutorial on google code).
Problem: As I understand, pmm_alloc_page() returns a pointer to somewhere in memory. Is this what is going on: pd is somewhere in memory, and in the 1022'th index of that bit of memory, the pointer to the allocated memory is flagged with PAGE_PRESENT and PAGE_WRITE?
How, then, is paged memory managed?
4. What is the heap? (yes, I am clueless.) From what I know, malloc() can use physical memory allocation, however it has no way to be free()'ed. (right?) Whereas once a heap is setup, both malloc() and free() can be used to manage chunks of memory?
Forgive the dumbness of my questions, I am not strong with The Force.
Also, is there an IRC channel for osdev?
I can't find a concrete tutorial or article that explains, in a concrete and complete manner (with or without code examples, I think I'll be fine) about memory management, from physical, to paging, then the heap.
A bunch of questions:
1. What does it mean by 'A stack expands downwards'? Can somebody explain, using concrete memory addresses to me?
2. How is physical memory management done? I think it's something along the lines of simply keeping track of what you can and cannot use, splitting up that memory and passing pointers around?
3. I mostly get paging… *mostly*. I get the part where there's an address in memory, and you apply these flags to it… Like
Code: Select all
pd[1022] = pmm_alloc_page () | PAGE_PRESENT | PAGE_WRITE;
Problem: As I understand, pmm_alloc_page() returns a pointer to somewhere in memory. Is this what is going on: pd is somewhere in memory, and in the 1022'th index of that bit of memory, the pointer to the allocated memory is flagged with PAGE_PRESENT and PAGE_WRITE?
How, then, is paged memory managed?
4. What is the heap? (yes, I am clueless.) From what I know, malloc() can use physical memory allocation, however it has no way to be free()'ed. (right?) Whereas once a heap is setup, both malloc() and free() can be used to manage chunks of memory?
Forgive the dumbness of my questions, I am not strong with The Force.
Also, is there an IRC channel for osdev?