Files are not always stored on the Hard Disk in one contiguous chunk. Disk space is allocated in pieces called clusters (see discussion elsewhere), and allocated one cluster at a time from the next available free cluster list as the file is written out to the disk. After a while, gaps appear as files are created and deleted. These gaps may not be big enough for a new file to be allocated space in one chunk, so the pieces are scattered all over the disk. This is called fragmentation.
There are two important concepts which involve the hard disk and RAM. There are various tradeoffs involved between the RAM and the HD, once you start tinkering with the Virtual Assistant settings. You need to understand the two seperate concepts in order to best optimise the system for your particular job mix. One is Disk Caching, the other is Virtual Memory.
Although they do involve some of the same basic computing concepts, do not confuse the two things, as they are for different purposes. Disk caching pretends that your disk drive runs at almost the speed of RAM instead of about 100 times slower. Virtual Memory pretends that part of your hard disk is being used as 100 times slower extra RAM, by keeping track of RAM usage and shuffling data back and forth between the RAM and the SwapFile on the HD.
You can always improve system performance (within limits) by adding more real RAM, and always speed up your HD by buying a faster one rather than just tinkering with the Virtual Assistants - that is the Real World!
You can monitor just how much Disk Cache and Virtual Memory you are actually using with the System Monitor. Just don't set the update time to 1 second, or you may use up too much processor time by the monitor process, thereby un-optimising the system!
The Hard Disk Cache is some Real Memory set aside in the Operating System just for pretending that the Disk Access Speed is faster than it is. It is not, so use of this Cache makes the system have less Real Memory to run programs from, but if clever Caching Algorithims are used, then anticipated loads have taken place and are sitting in faster Real Memory waiting to be accessed as if the Hard Disk was faster.
Some Hard Disks and/or H/D controllers may have an inbuilt cache on board them which can speed up frequent access to the same cluster/track combination. If you have it, good. This is RAM physically within the disk hardware, and distinctly separate from the RAM on the motherboard of the PC. Some of the data on the disk is stored in that HD caching RAM as it is being accessed (or sometimes in anticipation of access), so it can be accessed quicker than via the relatively slow I/O channel and HD mechanism. While it is still in the HD internal cache, the data is available faster. Although you can have the whole HD controller built onto the motherboard - the HD controller's caching RAM (if any) is not directly addressable by the CPU for purposes of running programs, so is really outside this discussion.
There are different types of caching depending on whether one is interested in
only caching reads from the I/O device,
only caching writes to the I/O device,
or doing both,
or reading from disk with delayed write through to the I/O device,
or intelligent read ahead from the I/O device.
WIN9X has three options for the setting called Machine Profiles. These have effects upon accessing the hard disk. It is described in its own section under the topic of optimising Hard Disk access.
First, set the amount of RAM space the disk cache can use.If you have more than 16 Meg, Win95 usually tries to fill RAM with the disk cache, unless you tell it to have an upper limit (MaxFileCache). This means that all programs eventually end up in Virtual Memory, loading and running slow. Having the entire disk cached is useless if the programs can only run (slower) via Virtual Memory. Trust me, your machine will run like a dog unless you set MaxFileCache to a sensible value. 64Mb of FileCache is useless when you only have 64Mb...
Set this as described to stop Win95 from using up all of your RAM for the disk cache. Win95 will use what RAM is then left free for actually executing programs, holding programs not currently executing, but still loaded, and allocating Virtual Memory as required. Disk cache size will be shuffled up and down within the limits you specify, as Win95 decides for itself that the RAM may be better used for a particular purpose at particular times.
You can set MinFileCache to any multiple of 1Mb (in Kb), as long as it is less than or equal to MaxFileCache.
For MaxFileCache, put 1/3 to 1/4 the amount of your RAM.
This example will allow the disk cache to have a guaranteed minimum of 2 Meg and then only take up a max of MaxFileCache RAM. This will let you keep more programs in Real Memory, and thus be faster. If a program is opened and exited a lot, then after the first time it is loaded, it will then (usually, unless you have subsequently loaded a lot of other programs) be loaded direct (faster) from the Real Memory of the disk cache, rather than from the storage out on the HD.Change the setting until you find an amount that satisfies you. I have 64 Megs, and I sometimes use 12288 (12 Mb) or 16384 (16Mb) for MaxFileCache depending on what I am doing. But I have found that 8192 (8Mb) seems to be adequate for most tasks I need my PC for, and Windows rarely reduces it during a session, although I have seen it reduce it occasionally. With higher settings, Windows seems tempted to fiddle with it more often, needing to spend time doing internal calculations to shuffle the cache size up and down, with little noticeable difference in performance, except of course that everything else stops while it fiddles.
Since WIN9X has to use the CPU to handle the cutting down of the disk cache size, the CPU has to stop the task you are doing to process the change, then process the change before it can resume where it was. This means that you are slowed down anyway, so you may be better off with slightly less disk cache than you may at first think.
Warning: Setting MinFileCache to 0 may cause some programs to not load or run. If a particular program wants more than 2Mb minimum, then experiment.
WIN98 Note: Win98 seems to be a little better behaved. It is alleged to be not so greedy with its allocation of RAM to the FileCache. See also the ConservativeSwapfileUsage Option mentioned elsewhere.
Virtual Memory is a way the computer uses the hard drive to load and run programs rather than RAM. It does this by pretending that part of the HD is RAM. This usually only happens when you run out of RAM. Virtual Memory is a SLOW way to load programs and run them. It is possible to optimise WIN9X to speed up your Virtual Memory so that your computer works faster.
If you keep the Virtual Memory Permanent (The Swap File) so that WIN9X doesn't have to allocate space for it while doing its normal Disk I/O processes, your Virtual Memory will seem faster.
The basis of optimising Virtual Memory is based on the way the Hard Drive works.
Beware of some "Help Files": their advice may not be completely accurate. Anyway, if you have your HD split into several partitions, things are not always as simple as a basic explanation suggests, especially if you have some sort of disk compression software running.The Hard Disk (Windows is a File Allocation Table type based system) allocates space at the very start of the disk partition for the FAT table, where it keeps the details of what files are located in what clusters on the disk. If you have the FAT table cached, it will be able to read (faster) directly from the disk cache (which is in Real Memory) the details of what cluster it needs, and then go direct to there. WIN9X uses a special form of FAT called VFAT.
Having too big a disk cache, means that programs may then have insufficient Real Memory to load in, and then have to "run" from The Swap File (Virtual Memory). The Swap File is MUCH slower than Real Memory, so use of this makes the O/S run slower, but allows the O/S to pretend that it has more memory, so it can load more programs at the same time. If it has to switch between the different sections of code, you may have to wait as the O/S brings the code it needs back into Real Memory, but you at least get a chance to actually run the program, rather than just getting an error message that there is no memory to run the program.
If you have multiple partitions on the one physical drive, that will help, but not necessarily to speed up the disk accesses to The Swap File. Putting The Swap File on a drive (or partition) different from the Windows directory will keep The Swap File separate from the other files. If it needs to expand, and you have nothing else on there, then the extensions to The Swap File will be physically near the original, not scattered all over the disk, so access should be faster just when you need it.
If you only set up a moderate amount of disk space for the The Swap File, when it occasionally expands beyond that, the extra bit will be at the end (or anywhere the system puts it) of the disk, so negating the idea of putting it at the front (if you use something like Nortons Utilities to do this). This will occur just when you need it the most (the previously allocated Swap File being full because of the large number of programs or large data files) so the slow down will be even more dramatically noticeable.
There is another subtle effect that will affect the apparent speed of The Swap File (Virtual Memory). When the HD is created and formatted, the cluster size varies according to the HD partition size. See elsewhere for the full story, but the larger the partition, the larger the cluster size. A HD is formatted into sectors (usually 512 bytes), but these are then linked into contiguous blocks called clusters: the maximum number of clusters depends on the HD size. HD transfer (at the lowest level) is done a cluster at a time, with resultant overheads between cluster transfers as the data is moved into and out of buffers in RAM. Thus a larger cluster size, means that there is a slightly faster throughput. I would recommend thinking about creating a separate partition about the size of the Virtual Memory size, and then setting the cluster size to the largest setting your OS can handle, say 32Kb with a utility such as Partition Magic.
If you have more than one HD, you can improve speed the most by putting The Swap File on the FASTEST hard drive you have. That will lower your access time to The Swap File.
If you have all your programs and data on one hard drive, consider putting The Swap File on the other hard drive, even if they are the same speed.
If you have two separate IDE controllers on your motherboard, putting the disk for The Swap File on the second controller will also help things.
Putting The Swap File on another partition can also help. The old "rule of thumb" is "the least accessed partition on the most accessed drive on the least busy controller", but remember that putting it on a separate drive on a separate controller from where most of your disk accesses normally are also helps. Splitting up your file system across more than one drive and partition can ease the load on one part of the file system so that is a good place to start looking to put The Swap File.
But funnily enough, those big fast drives are not necessarily the best choice. If you have a fairly fast old small (say EIDE, but SCSI would be probably faster) 80-100Mb or so drive lying around, (which may be slower than your main drive) try putting just The Swap File on there. When the data needs to be accessed, the head may most likely be near where it is needed, since it will usually stay where it was last time it accessed the drive. This may be close to where the next access is required. Since nothing else will be moving the head, the apparent access speed may appear faster.
Put a minimum of hard drive space that you want as the permanent Virtual Memory (The Swap File).
Then put the maximum as much as you can without going overboard. Any more than 10% of a drive may leave you with no space to save files to.
When I had only 32 Mb and a 1Gb Drive, I used 32 Mb as the Maximum setting.
When I went to 64 Mb of RAM and a second 3Gb HD (set up as the new Primary Drive) split originally into several 16K cluster partitions, and let Win95 sort it out itself at the first. I now have it set to a minimum of 40Mb, and in a separate partition with not much else that gets used.
Win98 Note: Since moving to Win98, I have acquired Partition Magic. I now have a new partition set up just for the Virtual Memory Swap File, and the cluster size is set to 32Kb. The Swap File is rarely accessed unless I have some considerable computing effort going on, such as multiple browser windows open. I now set the Minimuum and Maximum to 128Mb - seems to run much smoother, and I have a special partition of 129 Mb (IMb free) with 32Kb clusters set aside for this.
Remember that if you set the maximum to say 800Mb or more, unless are doing something like using a CAD package to design the next America Cup entry, you are very likely to run out of System Resources long before you fill up all that Virtual Memory (The Swap File), so you have just wasted disk space. And if you really need that much memory to design that yacht, buy more RAM - it's faster than Virtual Memory! Your time may be worth more than any savings...
Note: Upgrading the RAM and the HD to a larger and faster one was the second best and most noticeable optimisation step I did (after setting the [vcache] settings). I rarely fire up The Swap File now during a normal session (I watch the System Monitor quite a lot!). I usually run out of WIN9X Resources first. And the machine feels smoother and less "lumpy".
Win98 Note: Under the [386Enh] area in SYSTEM.INI make sure you have set
ConservativeSwapfileUsage=1
to allow the O/S to store only one copy of any data it already has in the Disk Cache. Win98 can access the data in the Disk Cache directly by means of a pointer from the Swap File, instead of needing to copy it into RAM, and then store it in both the Disk Cache and the Swap File.
The Default is
ConservativeSwapfileUsage=0
which I don't think is too bright!
You may speed up your Swap File if you run Speed Disk and select "Optimize Swap File" in the options menu.
Customize it by selecting the tab that loads certain files at the first of the hard drive; select browse and find the file "win386.swp"; then let Speed Disk run. This is supposed to let the WIN9X virtual memory run faster, but see previous comments about fragmenting the swap file above. I found it better to put it on a seperate dedicated partition.
Another speed up method for some machines running some job task mixes, especially with more than 16 Mb of RAM.
It just changes the number of recently accessed folders (directories) and files that are cached, and consumes RAM accordingly.
| Machine Profile | Dirs | Files | Memory Consumed |
|---|---|---|---|
| Desktop Computer | 32 | 677 | 10Kb |
| Mobile or Docking | 16 | 337 | 5Kb |
| Network Server | 64 | 2729 | 40Kb |
A setting that is not appropriate may cause problems, e.g. setting a Laptop to a Desktop has been known to cause problems.
Note also that even in the latest WIN95 system updates (allegedly including OSR2 - 1997), the registry settings for the Mobile and Network settings are wrong. They need to be amended. If you know how to safely edit your registry, see MSKB Article Q138012 for the details of how to do it, otherwise don't touch, you can seriously break WIN95 if you corrupt the registry.
I amended my registry, and noticed that the disk was accessed far less for things such as the Send To: menu that is accessed by the right click on the desktop. I also noticed an improvement when accessing the MSIE Favourites. I have a large number of them, and the first search runs by loading from the HD, but any immediately subsequent searches run purely in RAM.
I further amended my registry entry to increase the number of directories cached to 1024. This does take a little more RAM, but I have sufficient for my purposes, and prefer the speed increase.
Remember that WIN9X on boot up, may look at many directories and files, so much may already be cached at boot up, depending on how much RAM you have and how you have set things up. If you always run a program such as a Virus checker (which looks at a lot of files and directories) on boot up, you may have a lot cached when it finishes running.
You can apparently speed up your hard disk by Defragmenting it with Defrag or Speed Disk. But this only makes a noticeable difference if you haven't done it for ages. If you have System Agent, set it to run the Defragmenter regularly at a time the machine is switched on but you are unlikely to be using the PC, say while the News is on TV. If you have the screen saver set, the PC will happily chatter away by itself without the screen burning out.
I Defrag only the fragmented files daily if the disk is above a few percent fragmented, and a full Defrag weekly or monthly for above a larger percentage.
WIN98 Note: The standard supplied Win98 Defrag utility is slightly different from the Win95 version. It doesn't differentiate between the situations where one just makes all the files contiguous, and a full Defragmentation run. But it does have an annoying option which tries to help you by claiming that it will make your programs run faster. This keeps track (in some files of its own) of what files you access and how often. Then it loads some of these at the start of the disk partition. I have found it to be not worth the effort. Not only do I detect no noticeable speed improvement, but EVERY time the Defrag utility is run, it will copy out all of the disk clusters for the first 10 to 12 percent of the disk and rewrite almost all of them back into almost exactly the same places, one cluster at a time. Not only does this mean that the Defrag process is much slower, but the first 10 or 12 percent of the disk clusters get extra hard useage, which can hardly do much for the disk life. I keep this option set off. I also thus find that there is no point running the Defrag utility as often as I did with Win95.
Yes, Cluster Size Matters. Pardon the pun. This section is currently still being writtten. But I seem to have run out of server storage allocation, so I don't have room at the moment.
| FAT cluster sizes for Partition Sizes | |||
|---|---|---|---|
| Cluster Size | Sectors Per Cluster | FAT Type | Partition Size |
| 512 bytes | 1 | 12-bit | 0-15 Mb |
| 1 KB | 2 | 16-bit | 3.9-31.5 Mb |
| 2 KB | 4 | 16-bit | 16-127 Mb |
| 4 KB | 8 | 16-bit | 128-255 Mb |
| 4 KB | 8 | FAT-32 | 0.256-8.01 Gb |
| 8 KB | 16 | 16-bit | 256-511 Mb |
| 8 KB | 16 | FAT-32 | 8.02-16.02 Gb |
| 16 KB | 32 | 16-bit | 512-1,023 Mb |
| 16 KB | 32 | FAT-32 | 16.03-32.04 Gb |
| 32 KB | 64 | 16-bit | 1,024-2,047 Mb |
| 32 KB | 64 | FAT-32 | 32.04-64 Gb |
| 64 KB | 128 | 16-bit | 2,048-4,096 Mb |
64 KB clusters - Only available with Windows NT prior to version 5.0.
FAT-32 - Only available with Windows 95 OEM Service Release 2, Windows 98, and Windows NT 5.0.
Other cluster sizes are available in later upgrades to later versions.
Thou art a Hard Disk Drive Optimiser in The Workshop of Life.
Return to my
or to The Virtual Fooles Troupe ![]()