There seems to be a general consensus that Vista is the only Windows OS which can actually make use of large amounts of spare memory. I'd like to take the opportunity to dispell this myth and show that XP can handle large amounts of RAM well - not just Vista.
I'll assume "large" refers to ≥4GB RAM (I have 4GB installed on my machine), which you'll typically never use more than 1GB.
How Vista uses your large amount of free RAM
Basically, Superfetch. What it does, is observe what files gets accessed often, and caches them by loading them into memory - the idea being to preload these before you issue an on-demand call to launch an application, for example (this speeds up access times since HDDs typically have slow seeks, especially compared to RAM seek times (note that this assumes HDDs have slow seeks - SSDs greatly improve upon this, though RAM is still typically faster than SSDs, but Superfetch will be less effective if you're only using SSDs)).
Throughout this guide, wee'll assume that you're using a HDD (most of you) and wee'll use this idea to speed things up by preloading stuff into RAM.
So what are the issues of Superfetch?
- It's not configurable
- It's AI controlled (in other words, pretty stupid)
- It's rather aggressive, and if you have lots of free RAM, can cause lots of HDD activity (especially if you load/unload large amounts of RAM often)
- Relating to AI controlled, it has known issues of stupidly trying to cache lots of things from external drives...
But isn't Superfetch better than nothing at all?
eBoostr
...is an application which gives you Superfetch on XP. In fact, it's actually better, because it's configurable:
Advantages of eBoostr:
- You can specify exclusion lists (works well with manual preloading, plus you can stop Superfetch from stupidly caching those 700MB AVI files)
- You can specify a cache size limit (so you won't get lots of HDD thrashing from RAM deallocation/allocation)
Disadvantages:
- Err, you have to install an application?
- The app isn't free... (but neither is Windows)
...and there, you have Superfetch for XP, and can make use of your mostly empty RAM.
Whilst wee're here, you may as well make use of eBoostr's exclusion list - I personally add *.avi, *.mkv (other video files etc), *.zip, *.rar, *.7z, *.iso, my Music and Video folders, removable drives, partitions with other OSes installed etc.
But can wee do better?
Side note: Hibernation?
If you're using a 32-bit Windows with 4+GB of RAM installed, you don't need to worry about this, since 32-bit can only address 4GB of memory. However, if you're running 64-bit Windows with 4+GB of RAM, you may notice that you can no longer hibernate. It so happens that Microsoft decided to stick a 4GB limit for hibernation, meaning that if you wish to use it, you're going to have to cap your addressable memory to 4GB. If you like using hibernation, and really don't need all your RAM, you could consider adding the /maxmem=4096 switch to your boot.ini to cap the addressable memory to 4GB. On my machine, with the switch, Windows detects 3.25GB of RAM installed. (the amount your machine will detect will depend on various factors, such as the amount of video memory you have)
But anyways, back to optimising your RAM usage...
Disable Kernel Paging
This is a basic tweak which you should always apply, if you haven't disabled paging entirely, that is. This registry edit stops Windows from offloading the kernel to your HDD.
Simply change the following key:
KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\DisablePagingExecutive
^ Change the value to 1.
If you're confident, you can disable Windows' paging altogether...
Manual Preloading and RAMDisks
Advantages:
- _total_ control over what is preloaded
- can speed up some other operations
- static cache loads much faster than the dynamically generated cache of Superfetch (a RAM image is faster to load than seeking around the HDD looking for apps)
- there is NO HDD "thrashing" since things are statically loaded and never actually unloaded
- caching system is much simpler = less CPU overhead (though there isn't that much CPU overhead with automated solutions)
Disadvantages:
- ...total control implies that you have to manually set up everything (it's not an automated set-and-forget solution like Superfetch)
- not as efficient in terms of RAM usage as some things may be loaded twice into RAM (but if you have plenty of RAM, this shouldn't be an issue, right?)
- like above, since stuff is statically loaded, the cache doesn't dynamically deallocate if you start using GBs of RAM (though again, if you have plenty, you should be fine, right?)
- potential for some data loss, though if set up correctly, there won't be anything serious (see Fast Writes VS Reliability below)
Okay, the basic idea here is to use a RAMDisk. A RAMDisk is basically a driver which allocates a bit of RAM which you can use as a drive to store files. Obviously, RAM is insanely fast compared to reads/writes/seeks from a HDD, so you can see the benefits, however the issue with RAM is that it's cleared when you shut the system down.
Some RAMDisk drivers will save a snapshot of the RAMDisk at shutdown, then reload the image back at startup. This does make your shutdown/startup times slightly slower, however reading/writing an image is pretty fast (since it's a sequencial read/write as opposed to random read/write where the HDD's slow seek times come into play).
Combine this with NTFS junction points, and you may have guessed how this can be utilized.
Fast Writes VS Reliability
One thing you may have noticed is that the RAMDisk image is only saved a system shutdown. This means that writes to the RAMDisk are extremely fast, since you're writing directly to RAM. On the other hand, if your system crashes, it won't have the opportunity to save the RAM image, thus you lose whatever changes have been made to the RAMDisk during the session. Thus it wouldn't be wise to stick your Word documents on a RAMDisk, for example.
Most applications write settings to the registry, so a computer crash shouldn't cause any losses, since nothing's written to the RAMDisk, but for those that do write to a file in its own directory, you could lose updated settings in the rare instance that your computer crashes and you've updated some settings.
Temporary Storage
Whilst saving critical data to a RAMDisk isn't a smart idea, RAMDisks make excellent temporary storage mediums - another advantage of RAMDisks (they're also not bad for storing non critical data which get updated and need to be saved across sessions, such as the Prefetch cache). I have two RAMDisks set up on my computer - one saves and loads an image at shutdown/startup - this is where my apps (and Prefetch folder) go, the other doesn't save/load anything - this is my temporary storage drive. Since RAM is very fast for reads/writes, using a RAMDisk for temporary storage is quite a good idea if you ask me, since temporary files don't need to be kept in the long term, plus the RAMDisk will automatically clear out old stuff when you turn off the computer, not to mention that you won't ever get any fragmentation issues with RAMDisks. This can especially speed up apps that like constantly writing/reading temporary data. You can also stick stuff like your browser cache in the RAMDisk (if you've got a heap of space, you could even rip a CD to RAM, then burn the CD off RAM - buffer underruns practically will be non-existent plus you won't fragment and wear out the HDD :P).
Setting it up
Okay, enough discussion - here's the nitty gritty on doing it.
I use Superspeed's RAMDisk Plus as my RAMDisk driver - it's not free though (there are other RAMDisk applications available, though you'll have to try them out (I was mainly driven by XP x64 compatibility)) - also the interface is a little buggy, though you should be able to get around it.
Installing the application shouldn't be difficult. After that's done, you'll need to consider the amount of RAM you want to allocate to RAMDisks (I guess it's theortically possible to dynamically size RAMDisks as you use the space up, but I haven't seen an application able to do this - if you do, please tell me :P).
On my setup, I have a 768MB disk for storing apps, and a 256MB one for temporary storage, so a total of 1GB allocated to RAMDisks. Since I'm limited to 3.25GB of RAM, taking away 1GB leaves me with 2.25GB. I have eBoostr using a 384MB cache, and considering that with kernel paging disabled, Windows XP64 with my background applications uses around ~384MB of RAM as well. This leaves me with 1.5GB of free RAM, which leaves plenty of headroom for loading large apps without disturbing any caches. You could probably quite easily be a bit more aggressive make your caches a fair bit larger though (I doubt you'll need 1.5GB of free RAM lying around, even with large-ish games).
Anyways, once you've got an idea of how you're going to use your RAM, continue reading:
Temp storage
In your RAMDisk application create a drive which you'll use for temporary storage, of appropriate size. If given the option for a filesystem type, I'd suggest using FAT, and if you are given the option for a block/sector/cluster size, choose a small-ish one. Since I use my temporary RAMDisk for some other purposes than just Windows temp files, I tick the "Create /temp folder" in my RAMDisk application, but this really isn't necessary (I generally like to extract the contents of archives, such as installer archives, to the temp RAMDisk).
After you've made your RAMDisk, tell Windows to use it. Go to Start » Run » sysdm.cpl » Advanced » Environment Variables. In the top list, locate the TEMP and TMP variables, and assign both to your RAMDisk - for example, if your RAMDisk is mounted at Z:\ , set the values of both TEMP and TMP variables to "Z:" (without quotes; I recommend dropping the trailing "\"). Do the same for the bottom listbox. And that's it!
You might to also want to get some other applications to use the temp RAMDisk, ie your browser cache.
Note: some (badly written) applications (*cough* Adobe CS4 installer) will write large amounts of data to the temp directory. Since you probably won't have an insanely large temp RAMDisk, you may have to temporarily switch the TEMP/TMP folders back to a HDD folder, run the app, and then switch it back. In general, applications _shouldn't_ write lots of temporary data, and if they do, they should at least provide the option to change the directory to which the data is written to. (fortunately, Photoshop itself provides options for you to specify the "scratch disk")
Application storage
If your RAMDisk application supports RAM image saving & loading, create a RAMDisk of appropriate size which you'll store apps on, and don't forget to set the option to save/load a RAMDisk image. I'd personally go for an NTFS filesystem (junctioning back to the HDD :P), but you could go for a FAT filesystem if you wish for performance. If given option for a sector/cluster/block size, choose a small to medium-ish one.
Now just install your applications normally. Once you've done so, copy the application's directory to your RAMDisk. On the RAMDisk copy, I suggest deleting non-essential files (such as help/readme files) to save space. If you chose an NTFS filesystem, you can also junction some rarely used directories back to the HDD. For the HDD copy, rename it to something else - this will serve as a backup copy should your RAMDisk fail. Now all that's left is to create an NTFS junction on your HDD which links to the directory you placed on the RAMDisk. Now your application is permanently loaded in memory, for fast loading.
In terms of actual performance gains though, it will vary depending on each application. The key concept is to try to reduce the number of HDD seeks. Thus, if your application is reading lots of stuff from the system directory when it loads, this probably doesn't help too much (since it's still reading lots of stuff from the HDD), however you can also load some other things into the RAMDisk to help. One candidate would be the Prefetch folder (%windir%\Prefetch), which isn't of critical importance, but having it on RAM does save a read/write during app loading. Another candidate could be the %windir%\assembly and %windir%\Microsoft.NET directories, if you have enough RAM, and use .NET based applications frequently - I haven't tried this myself though.
EDIT: should probably add, installing directly to the RAMDisk should be faster than using junctions (since the request is made directly to the RAMDisk as opposed to the HDD), so if you are able to do this, I recommend it (you can always make a backup copy on the HDD should you think the RAMDisk might fail).
eBoostr
If you're using this in conjunction with eBoostr, I suggest you add an exception to eBoostr's list, not to cache anything on the RAMDisks. You can go further and exclude each junctioned directory, to make sure eBoostr isn't caching stuff on the RAMDisk.
I hope this guide will be of some use to people. If you have any suggestions/criticisms, please feel free to leave them.