page tables

Hi,

I need to implement a page table structure that stores data in a 2D array, and can be accessed in a 3D manner. Also it needs to be a multi-level page table. I tried to look up some implementation details, but I didn't find much.
Can you please guide me to some tutorials, etc?
Last edited on
A 2D array accessed in a 3D manner???? Please explain
well, think about an image. It's a 2D array of bytes right? now you could access it two dimensionally like
image[0][0]
or if you really think about it, no matter you store it in 2D or 1D it will always have a*b elements.
This way if you differentiate between virtual and physical memory, you could access this array by an address translator that lets you access this image, which is stored in a 1D array, in a 2D manner.
like:
1
2
3
4
5
6
float image[WIDTH * HEIGHT]; //physical memory in 1D
float access_2d(unsigned int x, unsigned int y) //address translator
{
  return image[y * WIDTH + x];
}
float a = access_2d(12, 14);

it's just a matter of mapping between the coordinates. The same way you can store data in a 2D array, or multiple 2D arrays if required (multilevel page table), and access it in a 3D manner.
Even your OS uses such an operation to perform swapping and memory management, see: http://en.wikipedia.org/wiki/Page_table
Last edited on
Topic archived. No new replies allowed.