Page file on RAM disk
- AndrewAPrice
- Member
- Posts: 2302
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Page file on RAM disk
Does anyone know of a practical use with storing a page file on a RAM disk?
My OS is Perception.
Re: Page file on RAM disk
...MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
No, I think that's pretty much useless in practical circumstances.
Page files are meant to fake a larger memory capacity by using disk space instead, RAM disks are used to fake disk space by using memory instead. They're opposite concepts.
You could use it to test paging without wondering if any errors are caused by errors in the disk driver, though. (assuming you're confident your RAM disk code works, of course)
Does that count as "practical"? That's not practical use for the users of an OS, but it might be for the developers...
- AndrewAPrice
- Member
- Posts: 2302
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
What would happen if you ran a memory intensive program and the OS tried to copy the RAM disk driver into the swap file?
My OS is Perception.
- AndrewAPrice
- Member
- Posts: 2302
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
I ment, swap the RAM disk into the swap file, while the swap file is stored an a RAM disk!
My OS is Perception.
Re: Page file on RAM disk
Hi,
Cheers,
Brendan
If you've got a video card with 128 MB of RAM but the OS only uses VESA for video on that card and the highest resolution the card supports is 1024 * 768 * 32 bpp, then you'll have about 124 MB of RAM sitting there doing nothing.MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Page file on RAM disk
That is not really a RAM Drive though, merely alternative storage, that happens to be RAM that is not in Main Memory... the same as an electronic drive with self buffering RAM.Brendan wrote:Hi,
If you've got a video card with 128 MB of RAM but the OS only uses VESA for video on that card and the highest resolution the card supports is 1024 * 768 * 32 bpp, then you'll have about 124 MB of RAM sitting there doing nothing.MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
Cheers,
Brendan
Re: Page file on RAM disk
Having RAM that you can't use as normal RAM but that you can use as RAM disk. Video card RAM, PCI bus bound RAM, some odd type of configuration your OS doesn't get, broken memory you've explicitly disabled (but do wish to use the upper half of), some OS that can't comprehend high memory (>1M, >4G, >900M, take your pick).MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
- AndrewAPrice
- Member
- Posts: 2302
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: Page file on RAM disk
You're a genious!! Can I store my RAM disk on my video card?Brendan wrote:Hi,
If you've got a video card with 128 MB of RAM but the OS only uses VESA for video on that card and the highest resolution the card supports is 1024 * 768 * 32 bpp, then you'll have about 124 MB of RAM sitting there doing nothing.MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
Cheers,
Brendan
Does anyone know any documentation on accessing video card memory?
My OS is Perception.
Re: Page file on RAM disk
Hi,
Of course if your OS will only ever use one video mode then you don't need to care about the amount of memory other video modes would've used (or you could refuse to use any video mode that takes more than 4 MB and use the remainder for swap).
Then do "RAM_disk_start_address = video_physical_address + reserved_space" (and round it up to the nearest page), and "RAM_disk_size = video_card_RAM - reserved_space" (and round it down to the nearest page).
Once you've got the address and size of the RAM disk you'd need to map that somewhere (if you use paging). You may also need to be a little careful about how you access this RAM. For example, in a multi-CPU system, if write-combining is enabled you'll need to make sure the write-combining buffers are flushed before allowing other CPUs to access the data (otherwise another CPU could try to read the data from RAM before the first CPU has written it).
Of course if you actually use the extra video RAM you can't do this - for e.g. if you're storing textures in there, if you're doing page flipping, if you're doing hardware scrolling, etc. In this case you need to reserve more video RAM for video, or stop using it as swap space.
Cheers,
Brendan
It's simple enough - use PCI configuration space to map the video card's display memory at a physical address (or PCI or VESA to find out where it was mapped by the BIOS) and use VESA to determine how much RAM is present in the video card. Then get a list of video modes from VESA and work out the amount of memory each video mode actually needs ("lines * bytes_per_line") - the largest video mode is the amount of space to reserve for video.MessiahAndrw wrote:You're a genious!! Can I store my RAM disk on my video card?
Does anyone know any documentation on accessing video card memory?
Of course if your OS will only ever use one video mode then you don't need to care about the amount of memory other video modes would've used (or you could refuse to use any video mode that takes more than 4 MB and use the remainder for swap).
Then do "RAM_disk_start_address = video_physical_address + reserved_space" (and round it up to the nearest page), and "RAM_disk_size = video_card_RAM - reserved_space" (and round it down to the nearest page).
Once you've got the address and size of the RAM disk you'd need to map that somewhere (if you use paging). You may also need to be a little careful about how you access this RAM. For example, in a multi-CPU system, if write-combining is enabled you'll need to make sure the write-combining buffers are flushed before allowing other CPUs to access the data (otherwise another CPU could try to read the data from RAM before the first CPU has written it).
Of course if you actually use the extra video RAM you can't do this - for e.g. if you're storing textures in there, if you're doing page flipping, if you're doing hardware scrolling, etc. In this case you need to reserve more video RAM for video, or stop using it as swap space.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.