Page 1 of 1

Tracking physical pages issued

Posted: Thu Jan 02, 2003 4:43 am
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?

Re:Tracking physical pages issued

Posted: Thu Jan 02, 2003 2:00 pm
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!!

Re:Tracking physical pages issued

Posted: Thu Jan 02, 2003 4:26 pm
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.

Re:Tracking physical pages issued

Posted: Fri Jan 03, 2003 2:57 am
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!