Tracking physical pages issued

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
DarylD

Tracking physical pages issued

Post by DarylD »

Okay, I am having a little problem with my zero fill page allocation code, so while I mull it over I am looking at wider memory management issues.

Here is a question:

I have a free page stack which lists all the free pages left after unpageable memory (kernel/free page stack itself). Pages are taken from this currently for the page table/page directory entries as needed and for page faults on zero-fill pages (for the malloc code.)

What do people think is the best way of keeping track of all this. I was thinking of using a linked list attached to the process structure, but I get the feeling this might be a little overhead heavy for this task. And it needs to be fast too.

Maybe using a struct with say 32 entries, and then chaining these together which might be a good compromise.

I guess I will need to keep a track of physical-virtual mappings for pages issued.

Also, if these are attached to individual processes, it will be hard to track so maybe I should have a global structure like the free page stack containing a list of (process, virtual, physical) but this could be memory usage heavy.

What do you think?
Slasher

Re:Tracking physical pages issued

Post by Slasher »

hi,
the way i'm going to do mine is keep track of the pages on a process basis. Each process' control block will have a table that records which pages belong it ie stores the physical addresses. then when you have to free them you just push them on to the stack!!
Tim

Re:Tracking physical pages issued

Post by Tim »

In my virtual memory manager, if a page is allocated to a process, then it's part of the virtual memory system in some way. So I keep track of which physical pages are allocated to a particular virtual memory block, and that is enough. Some pages are outside of the VMM system, such as the kernel heap, and these are accounted for separately.
DarylD

Re:Tracking physical pages issued

Post by DarylD »

I think I will go for a system like you mentioned Tim, but I think I will go for a Process/Virtual/Physical structure, once I figure out an efficient way of doing it.

Actually starting to make some real progress now!
Post Reply