|
|
First
of, the more RAM you have the better, 128MB
RAM is ideally the minimum of what anyone running Windows 2000 should have.
This OS, much unlike Windows 9x has far better Memory management, one reason for
this is because its meant to, Windows 2000 is intended for business/server use,
not as a desktop system. Windows 2000 also uses a Paging file, which for all
intents & purposes is the exact same as swap file in Windows 9x, just a
different name (pagefile.sys) & a few other subtle differences.
If
you have below 128MB RAM or less then you really should buy more RAM. This would
be of far greater benefit to you than anything else. Much like the Windows 2000
Services guide this one goes into detail regarding settings & such, although
if you're like me it's nice to know why
& what you are doing. This is
also probably the most comprehensive/definitive Windows 2000 memory guide around
in terms of topics, settings & definitions covered. With that, on with the
guide.
IMPORTANT
NOTE
– You must be logged in as an Administrator
to make (most) changes to these settings. So log on as one if you haven't
already done so.
What
is Virtual memory?
It
is a hidden file on
the hard disk that Windows 2000 uses to hold parts of programs & data
files that do not fit in memory. The paging file & physical memory, or RAM,
comprise virtual memory. Windows 2000 moves data from the paging file to
memory as needed & moves data from memory to the paging file to make room
for new data. Paging file is also called a swap file.
Another
explanation is that it is, temporary
storage used by a computer to run programs that need more memory than it has.
For example, programs could have access to 4 gigabytes of virtual memory on a
computer's hard drive, even if the computer has only 32 megabytes of RAM. The
program data that does not currently fit in the computer's memory is saved into
paging files.
However,
it is generally more efficient to set this yourself rather than let Windows 2000
manage it (Although Windows 2000 does much better Memory management than Windows
9x does).
Hard
drive setup
As
you may know, the Page file exists on your hard drive(s), which is much slower
than using RAM. So speeding up your hard drive can improve Page file performance
a lot. Although more RAM is highly recommended, having fast hard drive will
suffice.
Open
My Computer, right
click on the hard drive(s), select Properties.
Select the Hardware tab. Now
highlight the desired hard drive & click the Properties
button. Finally, select the Disk
Properties tab & SCSI Properties,
where applicable. The following options can improve Hard drive performance. NOTE
- Some of those options may, or may not be available depending on hard drive
type, e.g. SCSI or IDE.
Write cache enabled: If you enable this feature, your computer sends an enable-write-cache command to the hard disk activating the hard disk write-back cache, & if you disable this feature, the hard disk write-back cache is deactivated. When enabled disk I/O performance may improve, although if you experience system failure e.g. Power loss, you could experience drive/file corruption. I'd recommend leaving this ticked unless your system is prone to bad shutdowns/power failure.Disable Tagged Queuing: Tagged queuing is done by the SCSI controller & driver to increase the speed of completing I/O tasks. This is accomplished by sorting the commands so the order of the commands issued to the physical disk drive to read or write results in the most efficient movement of the physical read & write heads. As you can guess, doing it in this sequential order is far more efficient than when disabled, resulting in greater I/O performance. You should only tick this if you are experiencing problems with a hard drive(s) as performance is slower when Tagged queuing is Disabled. Leave it unticked.
|
|
Hard drive setup (Cont.)
Disable
Synchronous Transfers:
There are 2 methods of transferring data
over SCSI cables, Synchronous & Asynchronous mode. Asynchronous mode
transfers use an interlocked handshake method where a device (adapter or drive)
cannot do the next data transfer operation until it receives positive
acknowledgment that the other device received the last data transfer properly.
Synchronous transfer mode permits the sending device to send multiple data
packets without receiving acknowledgment that the receiver actually received
every data packet sent. As a result, more data can be sent/received before
acknowledgement is required. You should only
tick this if you are experiencing problems with a hard drive(s), e.g. overlapped
requests, as performance is slower when Synchronous Transfers is Disabled. Leave
it unticked.
Enable
DMA support on your drives. Right click on My
Computer, select Properties.
Select the Hardware tab, then the Device
Manager button. Open IDE ATA/ATAPI
controllers, then open Primary
& Secondary IDE Channel. Select
the Advanced settings tab.
|
|
Enable
ATA/UDMA 66 support, assuming your hard drive(s) supports it that is. By default
in Windows 2000, support for ATA/UDMA66 is disabled
(On Intel chipsets at least). Click on Start,
Run, type in regedit
& hit Enter. Go to [HKEY_LOCAL_MACHINE\System\CurrentControlSet\
Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}
\0000]. Add a New
DWORD value entitled EnableUDMA66
& give it a value of 1 to enable
support for UDMA/ATA 66, 0 disables
it. This can greatly improve hard drive performance if supported, remember the
Page file is located on your hard drive(s) too; the faster the data transfers
the faster your Page File is. NOTE – This is not
the same as enabling DMA support as shown previously.
Memory
dumps
Windows
2000, much like previous versions of NT, will dump the contents of memory to Memory.dmp
in the event of a Stop, or other fatal error. You can then use this Memory.dmp
file for debugging the cause of this error. If
this is your sort of thing you'll need
to have your Paging File set to (at least) RAM
+ 12MB for the file to be created.
Personally,
I don't find this of much use to myself, nor should it be of much use to most
users out there. To edit the Memory dump settings, right click on My
Computer, select the Advanced
tab, then the Startup and Recovery
button. You should concern yourself with the settings under the Write
Debugging Information heading.
|
|
I'd
personally recommend setting it to (none)
unless you are into debugging
crashes. Ask you System/Network Administrator for more information if possible.
Why
concern yourself with this? Well, if you have your machine setup to write these
Memory dumps you need a certain amount of Page File in order to do so, hence it
effectively limits what you can do with your Page File settings. If you select Complete
Memory Dump then follow the recommended Minimum of RAM
+ 12MB for the Page File, or use RAM
* 1.5. You should also skip the Calculating
Paging File size section.
|
|
Dual/Multiple
CPU’s
As
you probably already know (or are about to) Windows 2000 supports multiple
processors. What affect does this have on the Page File? Quite a lot actually -
Multiple CPU’s means multiple (more) L1 & L2 cache. L1/2 cache is
significantly faster than RAM & the Page File is, as a result having more of
this will mean less Page File usage.
If
you upgrade your current system to one that has multiple CPU’s then you’ll
need to take the following procedure as you’ll need to update the HAL (Hardware
Abstraction Layer) to be able to support these extra CPU(s).
Before
doing so check whether or not your manufacturer offers a specific HAL update for
this purpose. NOTE – Some of the following information can be read in this MSKB
article.
1.
Right click on My Computer, select Properties.
2.
Click the Hardware tab, then click the Device Manager
button.
3.
Open Computer & then double click on the computer
type that is listed there, e.g. on my system that would be Advanced
Configuration and Power Interface (ACPI) PC.

4.
Select the Driver tab, then the Update Driver button.
Finally, click the Next button.
5.
Select Display a list of known drivers for this device, then
select the Show all hardware of this device class button.

|
HAL |
Description |
|
ACPI
Multiprocessor PC |
Use
for Multiprocessor ACPI systems. |
|
ACPI
Uniprocessor PC |
Use
for ACPI Multiprocessor board but with a single processor installed. |
|
Advanced
Configuration & Power Interface (ACPI) PC |
Use
for Single processor motherboard with single processor ACPI system. |
|
MPS
Uniprocessor PC |
Use
on non-ACPI systems dual processor motherboard with a single processor
installed. |
|
MPS
Multiprocessor PC |
Non-CPI
systems with a dual processor running |
|
Standard
PC |
Any
Standard PC, non-ACPI, or non-MPS. Could be a 386, 486, Pentium, or
Pentium II / III. |
|
Compaq
Systempro |
Use
for Compaq Systempro computers. |
6.
Select the Manufacturer & Model as appropriate (one
that matches your current type, except for multiple CPUs), click Next,
and then click Finish.
|
|
Calculating
Page File size
Before
you can set your Page File you’ll want to get an idea of what to actually set
it too. Some recommend using a general formula, e.g. RAM*2.5. This is incorrect
however. Using that formula, a person with 16MB RAM should set 40MB, while a
person with 128MB RAM should set 320MB. Clearly the person with little RAM needs
a greater amount of Virtual memory than the person with a lot of RAM.
To
begin with, let Windows 2000 manage your Virtual memory settings, although with 1
adjustment. During Installation Windows 2000 by default
sets your Paging File to Physical
RAM*1.5. The adjustment is to simply set the Maximum
= Minimum/Initial size. To change this right
click on My Computer, select Advanced
then the Performance options button,
then Change. Simply edit the Maximum
size to equal the Initial size
& then select Set & Ok.
Reboot for the changes to take
effect.
Open
up System monitor (Click on Start,
Programs, Administrative
tools, Performance), open the Performance
logs & alerts section, then Counter
logs. In the right hand pane right
click & select New log settings.
|
|
In
the General tab select Add.
For the Performance object, select Paging
File. Select % Usage Peak & _Total
respectively. Over the next few days load up System
monitor & let it track your Page file size. I'd recommend saving the log
as a Text file, e.g. CSV
format.
It
would be best to start tracking your usage when you go to play a game or
something that will put your PC under a bit of stress. Run a few timedemos or
play Unreal tournament/Quake 3 against some bots. This will give you an idea of
your Page File needs, however don’t go overboard with the testing you want to
track normal usage, not excessive usage. The results are saved in the log file.
Once
you’re satisfied with your monitoring its time to consult the logs. Open your memory.csv
(or whatever you saved it as) with Notepad.
You’ll be greeted with something like this.
|
|
E.g.
In the logs shown above, 13.37 is
the peak value. Assuming my Page File had been set to 192MB
then my recommended value would be worked out as follows. 192/100
= 19.2, 19.2
* 13.17 = 25.6704MB, or 26MB.
Setting
the Page file
Based
on your results, there are 2 different methods that should be considered when
setting the Page file. 1 is to create a permanent, fixed page file; the other is
to create a semi-permanent one. The benefit of a semi-permanent one is that, if
needed, Windows can enlarge the size of it accordingly. This will eliminate the
chance of Out of memory errors occurring. After any
resizing of the page file above the minimum Windows will bring it back to its
original Initial size.
If
you want to go the Permanent route then set the size about 30-50MB’s
larger than the value you’ve calculated, e.g. given the values calculated
above you’d set both the Minimum & Maximum to 70MB. This will allow for
unforeseen circumstances where extra Virtual memory is needed. Given the large
size of hard drives today you should have no problem allowing for the extra
space needed for this.
Once
you’ve decided on which method you want to choose, take the following steps.
1.
Defragment your hard-drive &
then reboot your PC.
2.
Right click on My computer &
select the Advanced tab.
3.
Select the Performance options
button.
4.
Select Change. Select the hard
drive(s) you wish to use for the Paging File. Chose step A or B depending on
which path you choose to take.
5
A. If you’ve chosen to use a Permanent
fixed page file set both the Initial
size & Maximum size the same
(substitute in your own values of course).
5
B. If you’ve chosen to use a Semi-Permanent
page file set it as shown below (substituting in your own values of course). For
the Maximum size however set it to
double the minimum depending on the size & amount of free space (or use
more/less if you see fit). The values shown below are those I
use.
Remember,
the Initial size is what will automatically
be used for the Page File, no more will be used unless
it’s needed, up to the Maximum Size.
|
|
|
|
Further
optimizing the Page file & Memory
Below
are some other tips to improve your page file performance &/or stability.
Try
to avoid having a Page file on the
same drive as the system files. This only
applies to those with multiple hard
drives available for use.
Avoid
putting the Page File on a fault-tolerant drive, such as a mirrored or RAID5
volume. Page file(s) don't need
fault-tolerance, & some fault-tolerant systems suffer from slow
data writes because they write data to multiple locations.
Don't
place the Page File on different partitions on the same
disk drive. Placing the Page file on a separate partition increases access time
& head movement. NOTE – This is not
the same as placing it on separate
hard drives. If you have multiple hard drives try either placing the Page file
on the other hard drive, or split evenly between both hard drives, as shown
below.
|
|
The
Page File is best placed on the outer
edge of a hard disk, where it can be accessed quickest. Windows 2000 Disk
Defragmenter won’t do this unfortunately. You’ll need a disk defragmenter
like Norton speed disk to do so.
It
is not recommended that you put your
Page File onto a separate partition as this will increase the time to access it
& increase hard drive head movement as well. Instead, it is recommended that
it be placed on the most used partition of the least used drive. This will mean
the drive where Windows is installed for users with 1 hard drive. If you have
another hard drive installed you should use that instead. To change where the
Page file is located, change the Hard disk location when setting Virtual memory.
You
can also optimize performance for memory/processor use, depending on how your PC
is used. Go back into Performance
options. You have a choice to optimize for either Applications or background
services. Unless you are running something like a server you'll want to select Applications,
this specifies that more processor
resources are given to the foreground program than the background program.
This helps out if you are playing games or other such programs. Servers will
generally need to allocate resources evenly across all running tasks, so select Background
services for these; this specifies
that all programs receive equal amounts of processor resources.
|
|
Open
a new text file up, using Notepad.
Enter in the following line:
Mystring
= Space(16000000)
Save
it as filename.vbs, where filename
is whatever you choose to name it. The .vbs
extension is very important though,
choose to save it as All files
otherwise it will end up as filename.vbs.txt
which won't work. You should close all running applications before using it. To
use it simply double/single click it. Also, if you wish you may use values
greater than 16. Don’t set it higher than the amount of RAM you have
though.
Finally,
check out the Windows
2000 Services guide, which can help you reduce the Memory usage
of services.exe.
|
|
Sharing
the Page File
If
you are dual booting Windows 9x & Windows 2000 you may find it useful for
both Os’es to use the same Page File. This is a good way of saving space on a
hard drive. For sake of convenience, you should set the Initial/Minimum
size of the Page File the same for both
Operating Systems, the Maximum size
is irrelevant for this purpose as it reverts to the Minimum size when possible.
Before
you consider renaming your Page File you must meet one criterion. That being
that you cannot share a Page File on
a NTFS partition, Windows 9x doesn't recognise NTFS. As a result, you can only really
share the Page File when on a FAT32 partition. For sake of convenience, I'll
assume that you want to have both Operating systems share the Page File on the
(FAT32) C:\
drive.
The
Windows 2000 Page File is named pagefile.sys,
while the Windows 9x Page File is named WIN386.SWP.
You can rename either, although renaming the Windows 9x Page File is easier.
First load Windows 2000 & set your Page File to the appropriate size &
location, e.g. C:\pagefile.sys. Once
you've made your changes reboot.
Now load Windows 9x & set your Page file to the same Minimum size as the Windows 2000 Page File. Click on Start, Run, type in system.ini & hit Enter. Under the [386Enh] heading the changes will be made.

Change
the following lines as appropriate;
PagingDrive=x:\pagefile
- Change x to the appropriate drive,
obviously set this to the same drive as the Windows 2000 Page File. Change pagefile
to the name of the Windows 2000 Page file, i.e. pagefile.sys
(unless you renamed the Windows 2000 Page file, in which case, substitute in the
appropriate file name).
E.g.
If I were to share my Page File on the C:\
drive then I would have PagingDrive=C:\pagefile.sys
entered in.
MinPagingFileSize=x
– Where x represents the Minimum/Initial
size of the Page File. The value for x
is in bytes & as you may recall it must
be set to the same size as the Windows 2000 Page File. E.g. If the Windows 2000
Page File was 192MB then you should enter in 198
* 1024 (remember, value to be entered is in bytes) = 202752.
Registry
settings
In
Windows 9x there were a few extra settings to improve memory performance by
adding/editing some lines in the system.ini,
e.g. ConservativeSwapfileUsage=1
would significantly reduce Virtual memory use. Windows 2000 has other settings
available, although they are accessed via the registry rather than system.ini.
Click
on Start, Run.
Type in regedit & hit Enter.
Go to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management]. You may add/edit
the following entries as you see fit for your system. Some
of these settings were obtained via various MS
Knowledge Base articles.
ClearPageFileAtShutdown.
This is a security related setting. Using this DWORD
value you can "clear" the contents of the Page File when shutting
down the machine. Right click on the entry & select Modify.
A value of 1 enables this feature, 0
disables this. I'd recommend leaving this set to 0
unless you are truly highly security conscious. Performance is
not affected, although shutting down will take longer as a result.
DisablePagingExecutive.
Using this DWORD value, you can prevent
pageable drivers & system code in the Windows NT Executive from being paged
out to disk. Although this decreases the response time in systems with extremely
large amounts of physical memory (RAM), it is critical that there is enough RAM
installed. If you have enough RAM (128MB+ ideally) in your system then you
can benefit from disabling Paging
the NT Executive to the hard drive, with insufficient RAM performance may be
adversely affected, so you may want to try this setting both enabled &
disabled to see which is better. Right click on the entry & select Modify.
A value of 1 disables
Paging the NT Executive to the hard drive (faster), 0
enables Paging the NT Executive to
the hard drive (slower).
IoPageLockLimit.
Using this DWORD value you can
specify the limit of the number of bytes
that can be locked for I/O operations. Right click on the entry & select
Modify. Select the Decimal button
& enter in the amount (in bytes, e.g. 1024
= 1MB) that you wish to use. When this
value is 0, the system uses the
default (512K). The maximum value is
about the equivalent of physical memory minus pad, which is 7 MB for a small
system & grows as the amount of memory grows. For a 64 MB system, pad is
about 16 MB; for a 512 MB system, pad is about 64 MB. Using values larger
than the default (0)
may improve performance. Right click on the entry & select Modify.
Select the Decimal button. Try using
values ranging from 1024 to 16384,
in steps of 512.
LargeSystemCache.
Using this DWORD value you can
specify that the system favour the
system-cache working set rather than the processes working set.
This allows Windows 2000 to use RAM
– 4MB for disk caching purposes. The 4MB
free is used for faster launching of new applications. By default
in Windows 2000 Professional this is disabled,
although in the Server version it is enabled
by default. Right click on the entry & select Modify.
A value of 1 enables the LargeSystemCache,
0 disables it. If you have a lot of
RAM enabling this will be of great benefit to performance.
Registry
settings
(Cont.)
PagedPoolSize.
NOTE – This setting is included more for sake of completeness than anything
else, although some of you may find
it useful. Using this DWORD value
you can specify the size of the Paged pool in bytes. This setting is related to
the Maximum registry size in Virtual
Memory. When this value is 0,
the system uses the default size (32MB).
In [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
there is an entry entitled RegistrySizeLimit
(Or Add a New
DWORD value). This specifies the
total amount of space that can be consumed by Registry data. The system ensures
that the value for RegistrySizeLimit
is at least 4MB & no greater than about 80% of the size of PagedPoolSize.
Setting RegistrySizeLimit to 0xffffffff
(Hexadecimal) sets the value to be as large as 80% of PagedPoolSize.
You can allow for a bigger Registry by setting the initial PagedPoolSize, or you
can set the value of RegistrySizeLimit. If you want a very large Registry, set
both. However, for all but a few domain controllers, RegistrySizeLimit
never needs to be changed. When you set a registry size limit, it limits both
the page pool size & the amount of disk space that can be used by the
registry. The default is 8MB
(25% of the default PagedPoolSize).
PagingFiles.
This BINARY value contains the
settings that you have set in Virtual
Memory. It is however useful in that you may change the name
of the Page File with this entry. Still, if you are dual booting with Windows 9x
it is infinitely easier to rename the Win9x swapfile, rather than the Windows
2000 one.
SecondLevelDataCache.
Using this DWORD value you can
specify the amount of L2 cache you have in your machine. SecondLevelDataCache
records the size of the processor cache, also known as the secondary or L2
cache. If the value of this entry is 0,
the system attempts to retrieve the L2 cache size from the Hardware Abstraction
Layer (HAL) for the platform. If it fails, it uses a default L2 cache size of 256KB.
If the value of this entry is not 0,
it uses this value as the L2 cache size. Right click on the entry &
select Modify. Select the Decimal
button & enter in the amount (in KB's) of L2 cache you have in your system.
This can be quite useful with some CPU's, e.g. Pentium 3's can have either 512
or 256KB of L2 cache, depending on the model you have. It's also useful in that
no time need be wasted determining the amount of L2 in your system.
SystemPages.
This DWORD value is irrelevant to most
people who are reading this, although if you really want to know more about it
check out this Microsoft
KB article.
POSIX,
OS/2 disabling
You
could free up a small amount of
memory by disabling support for
these 2 subsystems. This is a highly important tweak as essentially no
other methods work now. Why? Windows 2000 File Protection System recreates
renamed/deleted system files. So while the method of renaming the Posix &
Os/2 files may have worked in Windows NT4, it will not
work in Windows 2000. If you need support for either of these, you can simply
ignore the sections regarding to deleting that subsystem.
You
may want to backup the registry before doing this, or at least export the
affected registry keys.
Click
on Start, Run,
type in regedit & hit Enter.
Go to [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OS/2
Subsystem for NT] & Delete all
subkeys. Now go to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment] & Delete
the Os2LibPath entry. Finally, go to
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\SubSystems] & Delete
the Optional, Os2
& Posix entries.
Reboot
your machine for the changes to take effect. NOTE
– As mentioned earlier, Windows 2000 will recreate renamed system files so
search for the files that were supposedly "renamed", there most likely
exists the original file, plus the renamed one in your System directory. Delete
the renamed versions.
Conclusion
You’ve
now optimised your Virtual memory system. With a bit of luck you should notice
less hard drive accessing & less Page file resizing. Make sure to check out
the other
guides for optimising other components of your system.