The magazine of the Melbourne PC User Group

Cache, what is it, and what's it for?
Tim Hardman

Cache - it's a strange word, but quite an important one in the computer industry these days. Let's look at what it is, what it does and why it's needed.

Basically, cache is memory, whether it be a portion of RAM set aside for that purpose or separate memory chips. The easiest way to explain cache's purpose is with an example. I'm going to use SmartDrive, a small TSR program that comes with DOS and Windows.

Once you've installed DOS or Windows, your AUTOEXEC.BAT file will usually execute SmartDrive upon startup. It will be loaded into memory every time you boot your PC normally. (Note: SmartDrive will usually be taken out of the startup files if Win 95 is loaded because it's designed to take care of these arrangements itself.)

Okay, SmartDrive loads itself into memory, but what does it do?

Basically it sets aside an amount of RAM (usually 0.5 to 1 MB of XMS or EMS memory). Then it keeps an eye on which data or files are being accessed from the hard drive(s). What it's doing is taking an educated guess about what data will be required next, then it loads that data into the SmartDrive-reserved portion of memory. When the CPU looks for more data, SmartDrive steps in, asks the CPU if it wants any of the data it has put into its part of RAM. Usually SmartDrive is smart and the CPU says, "Thanks for the data, you've just saved me heaps of time," (or it would if the CPU talked and had the sort of manners that require please and thank you).

Getting the data from RAM is much, much faster than getting it fresh from the hard drive. So there's one reason cache exists.

Other types of cache

Of course SmartDrive isn't the only cache that exists. There is hard-drive cache and cache on the interface cards that connect them to the bus and in turn to the CPU.

One of the more important instances of cache these days is the internal cache, built into the CPU itself and the external cache on the motherboard.

Let's talk numbers first

Most motherboards come with at least 256 KB of external cache with the option of upgrading that to 512 KB of cache. CPUs generally have 128 KB of internal cache. Intel Pentium Pro and Pentium IIs are exceptions to this general rule.

Wonderfully smart Intel scientists have decided that, instead of trying to make CPUs tick over so fast that they melt, they'd build more cache into the CPU. This, believe it or not, greatly improves the speed of the processor. Thus Pentium Pros come with 256 KB of internal cache, Pentium IIs with 512 KB.

Okay, I hear you asking. We have internal and external cache. But what does the stuff actually do?

Remember SmartDrive? Cache pretty much works as SmartDrive does for a hard drive, only it's doing the guesswork for RAM, rather than the hard drive(s). One reason cache is so important today is the speed of modern processors. These days CPUs can accept instructions and data so quickly that we cache, otherwise the processor would be sitting around waiting for data, files or instructions.

To see just what kind of effect cache has on your PC's performance, you could go into your PC's CMOS setup and disable internal and external cache and see how much slower your PC runs. 
Note: Do not do this unless you know what you are doing or have the guidance of an experienced person at hand. Never, never fiddle with CMOS without a recent, proven backup from which you can restore your system.

About the author
Tim Hardman is a part-time Computer Technician, currently studying Electronics Engineering at the Royal Melbourne Institute of Technology. You can contact him via email at sylvester@crafti.com.au.


Reprinted from the November 1997 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]