WINDOWS PANES
<< Tips & Tricks
WINDOWS PANES
Tips & Tricks >>

Windows Swap File - Test Report and Defragmenting Tutorial

By the way, you've just surfed into a website very rich in information about Windows software, tips, tricks and tweaks. Don't leave without exploring the resources listed on the main page.

Author/Publisher:
Microsoft
Contact/Address:
www.microsoft.com

Test Report - Description

The Windows swap file (also termed - more or less correctly - swapfile, pagefile, paging file and, most appropriately, swamp file) has been a point of controversy since the earliest days of the Windows OS. There are endless discussions and postings on the Net dealing with its optimal size, location and properties.

Test Report - Pros

With modern memory-hungry bloatware produced by Microsoft & Co., the Industry has decided for you: you have no choice left, you simply need virtual memory (as you need a 10 GHz Pentium, a 60 TB disk etc.) Don't you fool yourself thinking that it's you who decide.

Test Report - Cons

Virtual memory is terribly slow. While the use of paging files does enable an OS to run several huge applications at once (which is called multitasking in nerdspeak), it reduces (not improves) the overall performance of a system.

Test Report - Optimization Tips, Tricks and Tweaks

Properties, and Changing Them
Many a word and many a nonsense has been said about the so-called permanent swap file (the term simply indicating a swap file that is fixed in size, so Windows can't resize it and, consequently, can't toss its pieces up and down your HD). This is achieved by manually setting the same min and max sizes for the swap file; if you only set the min size and leave the max for Windows to manage, you get a so-called semi-permanent swap file, with a fixed min portion and a variable leftover portion. At the present state of things, the latter is the only reasonable solution, since with Windows you virtually never know how much your virtual memory may grow! So deeply true is this that it's worth repeating: with Windows you virtually never know how much your virtual memory may grow! Let's take my case (Windows 98, Internet Explorer 5.0 & 5.5) as an example: if I happen to read several pages of a multiple-paged HTML document stored on disk (you probably all have such HTML books somewhere on your disks, say, a tutorial, a FAQ, a manual etc.) and jump back and forth a little, Internet Explorer 5.0 suddenly starts bloating up the swap file and doesn't stop even if I cease navigating between pages altogether. I may even leave the machine alone: when I come back in an hour or less, Internet Explorer 5.0 has blown the swap file to a disproportionate 500 MB or so. I suspect this must be a bug in Internet Explorer 5.0, which apparently keeps allocating more and more memory, although it will never really need it (it should be mentioned that I've configured it to use a proxy, which may be the culprit). The only solution is to close the browser without further ado. Hence, setting a maximum size, any maximum size, for your virtual memory - even if you set it to 1 GB - means possibly confronting Windows with an out of memory situation, and that means asking for trouble! Accordingly, as regards modifying (that is, specifying) the virtual memory max size, there's no question at all - you should definitely leave it at its default (unlimited). Now, about the min size. If you don't specify it, Windows may theoretically (if you have loads of free physical RAM, for instance) shrink the swap file to 0 or, more truly, to a couple of MB, which means that as soon as it gets larger again, Windows will scatter it all over the HD, producing a terrible fragmentation and, consequently, getting exceedingly slow. Thus, as Microsoft themselves put it somewhere in the Resource Kit Book or in the MKB, the most you can do for your swap file is provide it with plenty of contiguous disk space where it can thrive without getting excessively fragmented. The only way to do this is by defragmenting the free space on your disk with virtual memory disabled, and then enabling it. Or, by ensuring first that a swap file of certain size (say, 500 MB) is contiguous, and then setting its minimum to that size: that way, and that way only, at least its first 500 MB are sure not to get fragmented. Ever.
Now, the other hot issue with the swap file was its size as such. I've heard it argued many times that the formula "set the swap file to two, three, four, or even five times your installed RAM" is ridiculous and obsolete and was only valid in Windows 95. Well, alas, my personal experience with Internet Explorer 5.x w/ proxy described above suggests otherwise. I'm sad to say that, no matter what people theorize about it, even with 128 MB of RAM and Windows 98, a bulky 512 MB swap file simply won't stay unused. This raw fact may be sad, but it's nonetheless true.
And now, a word or two about the (in)famous ConservativeSwapfileUsage=1 setting that should supposedly improve your system's performance by forcing Windows to use up all available RAM before even thinking about swapping. Well, I've tried it and, on my system, there is no noticeable change before the RAM is used up - and there is terrible degradation as soon as the swapping begins. The whole system almost grinds to a halt. Moreover, I simply think that the swap file may not be the only culprit here - the notorious Windows "thrashing" may apparently take place for the most disparate reasons - write-behind caching, icon cache (re)building, temporary file creation/deletion etc. etc. That's why I'm increasingly convinced that it just can't be eliminated - unless you dump Windows and choose some other operating system, that is ;]

Defragmenting Tutorial

Optimizing? Tweaking? Enhancing? Simply Moving!
Now if you know, as I know you know, anything about hard drives, spin rates and radial velocities, you can make the simple inference that if you want a chunk of data to be read from (or written to) the disk at maximum speed, that data must be located on the outer cylinders of the platter(s). How may you achieve this enhancement? Well, many sites reccomend that you should get a trial version of Norton Utilities with its Speedisk util, which will do this task for you, and then uninstall the program. Or, that you get a similar utility from Mcafee/Network Associates, or whoever, and then uninstall the program. I assume this method would work as a breeze, since I myself have used it extensively back in the good old days of Windows 3.11, FAT16 and 8.3-type filenames with a good old version of Norton Utilities (8.0 I think it was). But since Microsoft started inventing FAT32, long filenames and so on, I just got fed up with buying a new version of Norton Utilities every three weeks or so. Not to speak of the other cool feature of Windows software: the uninstall procedure. Be honest to yourself, is there any software package of which you are absolutely sure that it uninstalls everything it installed?... See? That's why I resorted to freeware, shareware and ingenuity. Now, with Windows 95 there was a problem in that its native Defrag utility wouldn't re-sort the files while defragmenting your disk (although there were rumours it did take into account the files' access date, placing the most recently accessed files at the beginning of the disk - I just never dug deeply into that, at least not enough as to verify, or refute, those rumours). I took another shortcut, which I'll call
Moving It the Hard Way
To cut a FAT story thin, the idea was this: if you create a second partition on your HD, move all your data there, reformat the first partition and assign it as the Windows paging drive (or simply copy the swap file there), Windows will automatically write a contiguous, unfragmented swap file on the outmost cylinders of the first partition. Then, all you have to do, is copy the contents of the second partition back onto the first partition and dump the second partition, and voilą, the task is done. Of course, I would under no circumstances want to accomplish this using Partition Magic, since buying it would be tantamount to buying Norton Utilities, and that's not the spirit, now, is it? So I naturally resorted to freeware/shareware partition managers and must admit there are at least two great ones out there. If you are a destructive person and want to play with your system beyond recovery, try them out. Otherwise, I would only recommend them to extremely savvy users and to people who are going to use them on spare, non-critical machines. These utilities are: FIPS, Ranish Partition Manager and Zeleps's Partition Resizer. They all work well and they all work only from the native DOS prompt.
Moving It the Way Gill Bates Never
WANTED
optimizing troubleshooting performance faq swapfiles swap files virtual memory pagefiles paging files optimization tutorial enhancement enhancing defrag defragment defragmenting defragging tweaking changing modifying workarounds tips tricks tweaks
You To, Or,
Muggoshot's Best-Kept Secret
Now, the second method is valid in Windows 98 only, and it is so utterly simple I just can't stop wondering how noone has thought of it before. What doesn't bug me at all, on the contrary, is the fact that, despite its sheer simplicity, neither Microsoft themselves, nor any of the big software companies that produce Windows utilities, have disclosed it so far, although there has been a vivid interest on the part of Windows users. How would they sell their utilities, if they admitted that everything those utilities offered might be achieved with the aid of the OS alone? Do you still naively believe there is healthy competition between them? Wouldn't it be much more fair to say there's some sort of sick conspiracy between them, a conspiracy against us users? With the sole purpose of draining our pockets to the last nickle?
Well, anyway. Let's concentrate on the method now, step by step:

WINDOWS PANES
<< Tips & Tricks
WINDOWS PANES
Tips & Tricks >>