Question about paging and memory managment.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

Question about paging and memory managment.

Post by mangaluve »

I just have some general questions about paging and memory managment. I once implemented a memory manager, but I ignored paging (used segmented mode) and I didn't have multiple processes. However, is it right that every process, for instance the kernel, has it's own page directory? And the memory is always continuous (not the physical memory but with paging)? So if we limit ourselves to the kernel now. I start with one physical block of memory on a a certain location and make some allocations. When I need more memory, I take a free physical block from a map stored somewhere and I put it after the last used memory-block (with paging). So for my kernel, the dynamic memory looks continues? If I got multiple processes, I have one page directory for each process, and the dynamic memory is allways continous? Hope it made sense.
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

Re: Question about paging and memory managment.

Post by mangaluve »

Thanks!

So basically, when a process (in my case only the kernel) ask for more memory. Then I only modify the "next" page table entry for that process? (or perhaps the next X if I need more than one chunk)? So right now (Im about to start the implementation), somewhere I store a map of free physical blocks. When I need a new chunk I look through my page directory/tables for the next "unused" logical block, and then I make it point to the free physical chunk?
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

Re: Question about paging and memory managment.

Post by mangaluve »

Thanks! So when I need more memory, the heap allocator keeps track of the next continous logical page? And then it tells the VVM to map it to a free physical page? Sounds like the heap allocator doesn't need to do much then? Just keep track of the last page table and when one asks for more memory, it sends the next virtual address to the VVM? (i must have missed something)
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: Question about paging and memory managment.

Post by yemista »

Im am still learning these things so this might be off a bit, but I think the heap is supposed to have a dedicated address space, and can be expanded by the virtual address manager. I think the heap is there to provide actual areas of memory you can use, at least for the kernel. I dont know about user processes, but it is true that if a user process requests more memory, then relative to its address space, the virtual address manager must know what virtual addresses are free. The heap should be designed in such a way that it always knows how big it is, and what it has free, or at least in such a way that it can find out. Heap is just a pile of RAM that gets given out and taken back, virtual address manager cares more about the actual addresses and knows which virtual address have been assigned
Post Reply