One topic you might hear people discussing when they're talking shop about computers is how much random access memory (RAM) they need to add to their computer. Up to a point, adding RAM will normally cause your computer to seem faster on certain types of operations. RAM is important because it eliminates the need to "swap" programs in and out.
When you run a program such as a word processor or an Internet browser, the microprocessor in your computer pulls the executable file (.exe) off the hard disk and loads it into RAM. Large programs like Microsoft Word or Excel use large amounts ofmemory. The microprocessor also pulls in a number of shared dynamic link libraries (DLLs) -- shared pieces of code used by multiple applications. The DLLs take many more megabytes.
Then the microprocessor loads in the data files at which you want to look, which might total several megabytes if you are looking at more than one document or browsing a page with a lot of graphics. So a big application can easily take 100 megabytes of RAM or more, which can slow your system down significantly if there isn't enough memory. On your machine, at any given time you might have the following applications running:
- A word processor
- A spreadsheet
- An e-mail program
- A drawing program
- Three or four browser windows
- A fax program
- A Telnet session
Besides all of those applications, the operating system itself is taking up a good bit of space. Everything together may need more RAM than your machine has. Where does all the extra RAM space come from?
The extra space in your computer's RAM is created by an important operating system component called the virtual memorymanager (VMM). The VMM looks at RAM and finds sections that aren't currently needed. It puts these sections of RAM in a place called the swap file on the hard disk. For example, let's say you have your e-mail program open, even though you haven't looked at e-mail in the last 45 minutes. The VMM moves all of the bytes making up the e-mail program's .exe, DLLs and data out to the hard disk. That's called swapping out the program. The next time you click on the e-mail program, the VMM will swap in all of its bytes from the hard disk, and probably swap something else out in the process. Because the hard disk is relatively slow compared to RAM, the act of swapping things in and out causes a noticeable delay.
So should you just keep adding more RAM until your pockets are empty or your computer can't hold any more? If you have a very small amount of RAM (say, 256 megabytes), then the VMM is always swapping things in and out to get anything done. In that case, your computer feels like it is crawling. As you add more RAM, you get to a point where you only notice the swapping when you load a new program or change windows. Once your computer has more RAM than the software running on the machine uses, the VMM has plenty of room and you should never see it swapping anything. After that, adding more memory would have no effect.Some applications -- like Photoshop, many compilers, most film editing and animation packages -- need large amounts of RAM to do their job. If you run them on a machine with too little RAM, they swap constantly and run very slowly. You can get a huge speed boost by adding enough RAM to eliminate the swapping. Programs like these may run 10 to 50 times faster once they have enough RAM.
Leave comments below if you have any doubt and queries or simply want to comment on the post.