Swapfile Optimization Guide
 






Making The Swapfile Permanent

Back in the good old days of DOS 6.22 and Windows 3.1, everyone knew that creating a permanent and contiguous swapfile was the key to optimal swapfile performance. This was because if the swapfile was permanent and contiguous, the heads of the hard disk do not need to seek so much. If the swapfile was left as a temporary swapfile that was only created every time Windows 3.1 started up, it would normally end up at the end of the hard disk and fragmented. This means that every time the swapfile is read from or written to, the hard disk heads have to seek around the hard disk to conduct those operations. Needless to say, that eroded the performance of the swapfile.

From Windows 95 onwards, Microsoft encouraged the use of its new dynamic virtual memory system. This new method now only creates and sizes the swapfile according to Windows 9x/2k's needs. If more memory is needed, the swapfile size is increased and if there's a lot of spare RAM, then theoretically, the size of the swapfile diminishes. Microsoft claims that while its dynamic virtual memory system will simply grab the nearest (to the outer tracks) available cluster for the swapfile and thus, create a fragmented swapfile; it will be much faster than Windows 3.1's virtual memory system. As a bonus, no hard disk space will be tied up in a permanent swapfile.

But while the dynamic virtual memory system in Windows 9x/2k may perform better than Windows 3.1's dynamic virtual memory system, a permanent and contiguous swapfile is still faster. It will eliminate the need for the hard disk heads to seek all over the hard disk to access the swapfile. Check out the following pictures :-

Disk_Map_Temporary.gif (1549 bytes)
This shows a dynamic swapfile (brown)

Disk_Map_Permanent.gif (1583 bytes)
This shows a permanent swapfile (brown)

See how a contiguous, permanent swapfile differs from a dynamic one? Instead of seeking and reading from a set area in the case of the permanent swapfile, the hard disk heads have to seek all over the platters to access the clusters allocated to the dynamic swapfile.

As a result, a common operating pattern like the following may emerge -

Dynamic     : seek-read-read-seek-read-seek-read-read-read-seek-read-read-seek
Permanent : seek-read-read-read-read-read-read-seek-read-read-read-read-read

Of course, the amount of time needed to do the seek operation is different from the time needed to read a block of data off the swapfile but the logic remains. If the number of seeks can be reduced while accessing the swapfile, more data can be read in less time. This is the premise behind sacrificing some hard disk space for a permanent swapfile.

 

 
 

 

 
     
   

 

 
   

 
     
 

                   

 
   

 

 
 
Last Updated 07-09-2000

All trademarks used are properties of their respective owners.
Copyright © 1998-2000 Adrian Wong. All rights reserved.

 
Visit the new Tech ARP @ http://www.techarp.com/ !