VMM and page replacement questions
Posted: Sat Sep 03, 2005 4:43 pm
I've been thinking about how to arrange a virtual memory manager to keep track of what's what inside address spaces. The general consensus appears to be that the most efficient structures to use are binary trees, and I've come up with a node type for one of those:
As you can see, I've tried to optimize for size by turning two Boolean values into flags and shrinking the numerical values stored for pages in order to make the signed integer type usable.
However, I've been reading "Modern Operating Systems" and don't see any page replacement algorithm that operates on such trees. There are some things I can do (such as implement an algorithm modified for the tree), but I'm wondering what algorithms are available for the lazy man who doesn't want to implement a new one.
In the meantime, I'll be thinking of a new one. My ideas are this: Essentially, operating on a tree is most efficient if we know what node to operate on. So possibly (given that the OS will do like everyone does and put kernel, process image, libraries in specific regions of address space), an algorithm could seek out and operate specifically on the process image (useful for working set), or libraries or some other part of virtual memory. The real issue with the tree is that page replacement algorithms tend to operate best on entire address spaces. Perhaps if a node in say... a linked list for an aging algorithm corresponded to each VMM node the alternate treatment would become easier. Or perhaps VMM nodes could be given an extra pointer to link to each other address-wise for a page replacement algorithm.
These have been random thoughts for this post.
Code: Select all
type
PVMMNode = ^TVMMNode;
TVMMNode = packed record
{iVirtualPage's absolute value is the virtual page number. Its sign is used as a flag designating whether the page is writable (+) or read-only (-).
iPhysicalPage's absolute value is the physical page number in RAM or on disk, with the sign telling which. Positive value means the physical page is in RAM, negative value means it's swapped out.}
iVirtualPage,iPhysicalPage: integer;
pLessChild,pGreaterChild: PVMMNode;
end;
However, I've been reading "Modern Operating Systems" and don't see any page replacement algorithm that operates on such trees. There are some things I can do (such as implement an algorithm modified for the tree), but I'm wondering what algorithms are available for the lazy man who doesn't want to implement a new one.
In the meantime, I'll be thinking of a new one. My ideas are this: Essentially, operating on a tree is most efficient if we know what node to operate on. So possibly (given that the OS will do like everyone does and put kernel, process image, libraries in specific regions of address space), an algorithm could seek out and operate specifically on the process image (useful for working set), or libraries or some other part of virtual memory. The real issue with the tree is that page replacement algorithms tend to operate best on entire address spaces. Perhaps if a node in say... a linked list for an aging algorithm corresponded to each VMM node the alternate treatment would become easier. Or perhaps VMM nodes could be given an extra pointer to link to each other address-wise for a page replacement algorithm.
These have been random thoughts for this post.