सोमवार, 3 मई 2010

Windows Vista Memory Tweak Guide

With every release of a new operating system come new demands and Windows Vista is by large no exception to this rule.

There are several relevant components to the Windows memory subsystem. In this guide we will put special emphasis on the hard drive, processor and RAM, taking you through a variety of settings to optimally configure these and hopefully end up with an overall smoother running system.

Note: Most of the information and setting modifications covered here will require Administrative privileges.

Troubleshooting

For starters, it's always good practice making sure you have the latest Vista updates installed. For the purpose of this guide this is important as in many instances they may fix memory related issues, e.g. memory leaks, not releasing memory, etc. You can find and download relevant Vista updates using the built-in Windows Update, while hardware driver updates can be found at TechSpot Drivers. For application-specific updates check the developer/application site or use any built-in auto-update facility.

Registry Options

The System Registry contains several settings which will allow to further configure memory management features in Windows Vista. Used properly this can further improve your PC's memory subsystem performance - there are also several placebos we need to clear up as well.

To access the Registry click on Start, Run. Type in regedit and click Ok. Navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management].





























The options we are interested in are in the right hand pane.
To edit any entry simply double click on it or right click on the entry and select Modify. In parenthesis I'll cover which format the Data is to be changed in.

The more relevant options are as follows:

ClearPageFileAtShutdown. (Hexadecimal or Decimal). This setting allows inactive Pages in the Paging File to be cleared (overwritten with zeros) during shutdown. This is certainly worth considering if you're highly security conscious.

* When set to 0 (Default) inactive Pages are not written with zeros having no effect on shutdown time and making Page File data readable (this is recommended and certainly safe for home users).
* A value of 1 enables inactive Pages to be cleared during shutdown, which is useful from a security viewpoint. You can expect shutdown times to increase as a result; this is more appropriate in a business environment.


DisablePagingExecutive. (Hexadecimal or Decimal). This setting controls how inactive kernel-mode drivers and system code are handled by the memory subsystem.

* A value of 0 (Default) specifies that inactive kernel-mode drivers and system code can be released from RAM and paged to the Page File.
* A value of 1 specifies that inactive kernel-mode drivers and system code be retained in RAM.

It's worth considering that any performance benefit to this feature will only occur when restoring a process which had been paged out to the Page File. As such I would generally recommend setting this to 0, but if RAM availability is not an issue then a value of 1 may provide improved responsiveness when restoring applications that has been inactive for some time.

LargeSystemCache. (Hexadecimal or Decimal). This setting controls the size of the file system cache.

* When set to 0 (Default) a standard sized file system cache is allocated (Less than 10MB RAM); this is recommended as it provides best Application performance.
* When set to 1 this enables the use of a large file system cache (up to total RAM amount minus 4MB!); this option is only suitable when Windows Vista is acting as a Server not as a gaming system or for other workstation use as it will be detrimental to performance as Microsoft notes:

When you enable System cache mode on a computer that uses Unified Memory Architecture-based video hardware or AGP, you may experience a severe and random decrease in performance. The Drivers for these components consume a large part of the remaining application memory when they are initialized during start-up.

PagingFiles. This option specifies the location, file name and size of the Page File(s) for the system, for example; c:\pagefile.sys 1024 2048

Note - This is the similar to the Virtual Memory options window, accessible in the Performance Options, Advanced tab, pressing the Change button: although it does allow you to potentially rename the Page File if that is of use.

SecondLevelDataCache. This setting specifies the L2 Cache size of your CPU (Defaulting to 256K when unable to determine) and it's only appropriate to specify a value with CPUs with off-die L2 Cache (i.e. Pre-Pentium 2; in which case - update your hardware!).

With any remotely modern CPU Windows accurately queries this value via the Hardware Abstraction Layer and as such there's no need to adjust this option. While some suggest you may set this manually regardless; it's completely unnecessary. Leave this set to 0. Other options listed, e.g. NonPagedPoolSize, can be ignored and are likely at their default of 0; indicating they are calculated automatically based on system configuration, e.g. RAM installed. Regardless, there's no need to modify these yourself.

Now navigate to the PrefetchParameters subfolder ([HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters]).

Prefetching has been greatly enhanced in Vista, as such I'd recommend ensuring that EnablePrefetcher and EnableSuperfetch reset to their default values of 3 in the event they had been modified. Additionally there is no need to periodically clear the Prefetch directory (It clears unneeded entries itself), while using the /Prefetch command for launching Applications has no beneficial effect either.

Now navigate to [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer].

There may be a sub-key listed in the left hand pane entitled AlwaysUnloadDLL, with (Default) set to 1 in the right hand pane. Some recommend setting this as it frees unused DLLs (Dynamic Link Library) from memory quicker. This actually only applies to Windows Explorer extensions as Microsoft explains:

The Shell automatically unloads a DLL when its usage count is zero, but only after the DLL has not been used for a period of time. This inactive period might be unacceptably long at times, especially when a Shell extension DLL is being debugged. For operating systems prior to Windows 2000, you can shorten the inactive period by adding the following information to the registry.

Essentially, if you've got this sub-key listed right click on it (AlwaysUnloadDLL) and Delete it; it's completely unnecessary. Restart your system for changes to take effect.


Hard Drive Settings
Right click on My Computer, select Properties then Device Manager. Expand IDE ATA/ATAPI controllers. Devices listed in this pane will vary depending on your PC.



Double click the initial ATA Channel device and select the Advanced Settings tab.

Assuming you are using modern hardware the Current Mode should be displaying Ultra DMA Mode X, where X is a number. Make sure Enable DMA is ticked if this is not the case. Click OK and repeat the same check on any further ATA Channel devices.

Now expand the Disk Drives section and double click on the initial Hard drive listed, selecting the Policies tab.

For optimal performance this should be set to Optimize for performance, Enable write caching on the disk and Enable advanced performance - this last one only recommended for desktop systems with an uninterrupted power supply (UPS) connected, you may be prone to lose data otherwise
Performance Options

Open System Properties (right click on My Computer and select Properties), select Advanced system settings, then press the Performance Settings button, finally selecting the Advanced tab.


Processor scheduling. This option specifies how CPU time is to be shared between processes. By default this is set to Programs, which indicates that foreground processes are a higher priority for CPU time and is recommended for most users as Application performance will be of primary concern. When set to Background services CPU time is more evenly divided between processes, which is more appropriate for Servers. We'll return to this section later but for now click Apply and press OK, restarting if appropriate.

Memory Dump Options. Before adjusting the Page File size you'll need to check Memory Dump options as they affect exactly what you can do with the Page File and its size. Open System Properties, select the Advanced system settings tab, then the Startup and Recovery Settings button.

Write debugging information. This drop-down menu specifies the data to be dumped (useful for troubleshooting purposes) in the event of a STOP error occurring, four options are available:

* (none). Selecting this option sets that no data should be dumped. This is recommended as it places no restrictions or conditions on Page File configuration.
* Small memory dump (64KB). Selecting this option dumps minimal system information for troubleshooting purposes when a STOP error occurs. This requires a Page File of 2MB or greater located on the boot volume.
* Kernel memory dump. Selecting this option dumps kernel memory for troubleshooting purposes when a STOP error occurs providing more detailed information than a Small memory dump. This requires a Page File of 50-800MB located on the Boot volume.
* Complete memory dump. Selecting this option dumps the entire contents of system memory for troubleshooting purposes when a STOP error occurs. This requires a Page File of RAM + 1MB on the boot volume.

Click OK when you've made your choice (we recommend Small memory dump) and restart for the changes to be applied.
Configuring the Page File

Now that you've configured all relevant memory management options it's time to get to grips with the Page File itself. Depending on what site or forum you visit, the question "What should I set the Page File size to?" - is sure to bring a variety of responses and ensuing arguments. A few things to bear in mind...

* Vista automatically increases the Page File size should it be necessary (reducing it afterwards). This essentially means you can only notionally create a "Permanent Page File" (Initial size = Maximum size).
* If you have a single hard drive split into multiple partitions, the Page File should be set to the partition Vista is installed to. You should not create multiple Page Files for different partitions in this case.
* If you have multiple hard drives installed, it is beneficial to locate the Page File on the Hard Drive Vista is not installed to, but only if the other hard drive is of a similar or better performance.
* The Page File should not be located on a mirrored Drive, e.g. RAID array, if possible as fault tolerance / backup is not required and may decrease performance.

Note any Page File restrictions on location and size as a result of the Write debugging information setting previously selected.

Although I have previously recommended using the Task Manager to determine an optimal Page File size, given the increased size of hard drives that procedure is now somewhat redundant. Instead I would simply recommend assigning 1 - 2 GB (1024 - 2048MB) to the Page File.

Once more open System Properties, select the Advanced system settings tab and press the Performance Settings button, selecting the Advanced tab, finally pressing the Change button

Taking heed of the previous points, select the appropriate Drive, click Custom and set the Initial / Maximum size (MB), then click Set.

Now click Ok and restart your PC as required.
Performance trade-offs, misc. tweaks

While not the kind of "tweaks" we like to recommend, Windows Vista is a new operating system designed to run on faster computers, no matter what the minimum requirements tell you, the faster system you have the more enjoyable (or less painful) your Vista experience is going to be.

Disabling Vista's Search Indexer

One of the nicest things of Vista's search is that it's well integrated into the user interface, so if you rely on desktop search a lot, just ignore this tip, but if you rarely use Vista's built-in search or have no idea what I'm talking about then you may enjoy a smoother experience disabling Windows Search.

* Go to Start
* In the search/run box type "services.msc" then hit Enter. This will open the Windows Management Console.
* On the right pane, scroll down and look for a service called "Windows Search", then double-click it.
* On the properties window of Windows Search, click on the Stop button.
* Then in the "Startup type" drop down, click on Disabled.
* Close the windows and restart your system for the changes to take effect.
*

You can always go back and enable Windows Search, the only trade-off is that Vista will have to scan your hard drive again which can take minutes up to a few hours (all done in the "background").

Disabling unnecessary services

Similarly to what we did above, we could potentially disable a number of unnecessary services that are run by default on the background. There is no set list of what services should be running or not for everyone, but those will depend on personal preference and usage so your mileage will vary.

You can access the Windows Management console as indicated above and choose what services to disable from running. To assess yourself you can consult our old Windows XP Services guide (we may write a Vista-based one soon), or here's an external guide that may also be of help.

Disabling Vista Aero

Unless you are running on a very old graphics board - or even worse, integrated graphics - chances are you are not having much trouble with Aero. As with all eye candy however, Aero UI does takes its toll in overall system performance. You may want to try disabling it and see if this pleases your desire for a more responsive system:
* Right-click on the desktop and then click on Personalize.
* Click on the first option called "Window Color and Appearance."
* Look for the link "Open classic appearance properties for more color options." This will open a window similar to the one found in XP for choosing a color scheme.
* Instead of Windows Aero, you can choose from the less shiny "Vista Basic" or the older "Windows Standard" and "Windows Classic".

Removing unnecessary programs from startup

The classic tweak, and in many instances the most necessary one. No matter how trusted the software you install in your computer is, there is an ever increasing trend on developers setting its software to run at Windows startup in obvious (Start > Programs > Startup) and not so obvious ways.

Fortunately Vista's Defender is more capable than before, and you don't have to deal with the registry or even run 'msconfig' for detecting such unwanted applications...

* Go to Start
* In the search/run box type "defender" then hit Enter. This will open the Windows Defender panel.
* At the top menu click on Tools, then go to Software Explorer.
* This will display a friendly menu of currently running startup programs with useful information on the developer, file path, name and if you are lucky even more.
* For disabling a startup item, just select it from the left menu, then click the "Disable" on the bottom right (this is preferable over Remove unless you are 100% sure you don't want this running on startup).

A few more hints...
If a program is legit, it's likely it will show useful information, if it's just some generic non-sense you may be looking at spyware. If you are unsure of whether you should remove a program from startup, we have a searchable filename index that can help.

Oh, did we mention you can disable the Vista sidebar from this screen? You may want to think again if the Windows Sidebar is worth running or not and save some cycles and memory on the way (You can also remove it by closing it from the taskbar and choosing not to run it at startup when prompted).
ReadyBoost, BIOS and Closing

ReadyBoost

Do you have you any external flash memory laying around? If so, you may be interested in ReadyBoost, which allows Windows to use suitably fast flash memory for OS caching purposes as detailed by Microsoft:

ReadyBoost supports the use of nonvolatile flash storage devices to boost system performance. Devices enhanced for ReadyBoost provide dedicated space outside main memory where SuperFetch can store a cache of performance-crucial data for fast random access. Although not as fast as main memory, nonvolatile flash memory significantly outperforms conventional disk media in random reads by avoiding the rotational and seek latencies. All data written to the cache is compressed at a 2:1 ratio and encrypted by using AES-128 to ensure security of the data.

Upon connecting such devices Windows AutoPlay will prompt as to whether you wish to Speed up my system by using ReadyBoost and allocate the amount of memory you wish to allocate to it assuming the device passes the performance test.

ReadyBoost can provide noticeable performance improvements particularly on systems that meet only minimum memory requirements (1GB or less). We have tried it and it works quite well in such scenarios.

By default most BIOS settings are configured for compatibility over performance. As such, it's worth checking your BIOS settings to determine whether any options can be altered to allow for improved performance without adversely affecting system stability (RAM settings in particular like Latency timings, as well as Hard Drive related, e.g. ATA Transfer mode). BIOS options vary greatly depending on the age of the motherboard, the manufacturer and chipset. Options may also be added or removed depending on the BIOS revision used.

I recommend checking the Definitive BIOS Optimization Guide for optimal setup tips. The Memory Subsystem section alone covers 70 options.

Final Thoughts

If you have tweaked Windows XP in the past you will have noticed Vista has less options and in general less room for manual optimizations. Now, this is not a bad thing as we found out that Microsoft has automated in Vista many of those settings we used to recommend on XP, and in some other cases they have set optimal values as default. The bad news is that even then Vista continues to be a resource hog for many, especially those with older systems, leaving no choice but to keep XP for a while longer.

fly