Page 1 of 1
Page file on RAM disk
Posted: Mon Feb 26, 2007 5:42 am
by AndrewAPrice
Does anyone know of a practical use with storing a page file on a RAM disk?
Re: Page file on RAM disk
Posted: Mon Feb 26, 2007 7:25 am
by urxae
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...
Posted: Mon Feb 26, 2007 8:03 am
by Solar
I could come up with some esoteric combinations where the RAM disk is some network-mapped memory of some other machine but still faster than local hard drive or somesuch... but out in the wild? I don't think so.
Posted: Mon Feb 26, 2007 11:41 pm
by AndrewAPrice
What would happen if you ran a memory intensive program and the OS tried to copy the RAM disk driver into the swap file?
Posted: Wed Feb 28, 2007 3:03 am
by Solar
...swapping out the RAM disk driver...?
Why on earth should an OS do that? I mean... just why? That's almost as senseless as swapping out the hard disk driver...
Posted: Wed Feb 28, 2007 3:14 am
by AndrewAPrice
I ment, swap the RAM disk into the swap file, while the swap file is stored an a RAM disk!
Posted: Wed Feb 28, 2007 3:23 am
by Solar
Depending on the "brains" of the system, either all hell breaks loose or the safety catch is triggered.
Posted: Wed Feb 28, 2007 12:58 pm
by Crazed123
Or, of course, the pager program knows better than to even try.
Re: Page file on RAM disk
Posted: Wed Feb 28, 2007 7:59 pm
by Brendan
Hi,
MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
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.
Cheers,
Brendan
Re: Page file on RAM disk
Posted: Wed Feb 28, 2007 8:22 pm
by Tyler
Brendan wrote:Hi,
MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
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.
Cheers,
Brendan
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.
Re: Page file on RAM disk
Posted: Thu Mar 01, 2007 11:35 am
by Candy
MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a 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).
Posted: Thu Mar 01, 2007 5:06 pm
by frank
If you were going to use that memory space as a ramdisk and put the pagefile up there, why not just get rid of the pagefile and use that memory as normal memory. It just seems kind of circular to me.
Re: Page file on RAM disk
Posted: Thu Mar 01, 2007 6:25 pm
by AndrewAPrice
Brendan wrote:Hi,
MessiahAndrw wrote:Does anyone know of a practical use with storing a page file on a RAM disk?
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.
Cheers,
Brendan
You're a genious!! Can I store my RAM disk on my video card?
Does anyone know any documentation on accessing video card memory?
Re: Page file on RAM disk
Posted: Thu Mar 01, 2007 7:45 pm
by Brendan
Hi,
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?
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.
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