Memory Tweaks

Not so long ago, having 512MB of Random access memory on your Personal computer was considered a luxurious excess. Today, it’s the bare minimum. Running many programs at once, processing graphics and video, or caching heaps of Web pages–each devours Random access memory.

Insufficient or improperly configured memory can hinder a Pc’s performance and cause intermittent, hard-to-resolve error messages, or even system crashes. The best way to avoid this, of course, is to add more memory to your system.

Random access memory prices fluctuate rapidly, but they have trended down in recent years. I recommend upgrading to at least 1 GB.

But before you add memory, make the most of your existing Random access memory. Windows operating system has several settings for optimizing memory performance, as well as tools for finding and fixing memory-related problems.

When your Personal computer runs out of space in standard memory (its Random access memory chips), it stores overflow data in virtual memory, which is simply a large file–called a swap file–that’s located on your hard disk. Data is accessed from a disk slower than it is accessed from standard Random access memory, so it pays to optimize your swap file’s performance.

To view your swap file settings, right click the System icon on your desktop, select Properties, and choose Virtual Memory under the Performance tab.
Set Your Swap File

By default, Windows automatically adjusts your swap file’s size to meet its needs. A nearly full hard disk squeezes your swap file, and this can lead to sluggish performance or sometimes a system crash. So always have at least 100MB of disk space put aside for your swap file.

To set the size of the swap file manually, choose Let me specify my own virtual memory settings in the Virtual Memory dialog box. Select a minimum size and a maximum size, or enter the same number in both fields to fix the file at a constant size. Freezing the swap file’s size may increase system performance because Windows no longer has to adjust the file size, but it also increases your Pc’s risk of running out of memory.

If you have more than one hard disk, place the swap file on the one with the fastest access time. Do so by changing the value in the ‘Hard disk’ field of the Virtual Memory dialog box and then rebooting.

Defragmenting your hard disk can improve its performance as well. Over time, files get stored on a drive in pieces that may become scattered around the hard disk. A defragmentation utility rearranges the data on the disk to store each file in a single, contiguous block. Applications can access a file that has its pieces stored in close physical proximity on your drive much more quickly than they can access a file with scattered pieces.

To run Windows operating system’ Disk Defragmenter utility, select Start, Accessories, System Tools. Unfortunately, that won’t defragment the swap file because Windows considers it fixed data that can’t be moved. To overcome this hindrance, make the swap file as small as possible before you defragment by restarting your system and closing all apps that launch on start-up.

If you have enough physical Random access memory installed, you may be able to remove the whole swap file temporarily, defragment the disk, and then replace the swap file. Make sure your system has sufficient Random access memory to run Disk Defragmenter, however. If your system runs out of Random access memory and has no swap file, it may impact. See “Mind Your Memory” below for instructions on how to check your available memory.

To remove the file, check Disable virtual memory in the Virtual Memory dialog box and reboot. To reenable it, uncheck Disable virtual memory and reboot.
Mind Your Memory

Worried about running out of memory? To avoid system crashes, keep an eye on how much free memory you have left.

Windows’ System Monitor utility shows the level of unused memory Windows operating system has at any given time, along with several other useful performance statistics. To run the utility, choose Start, Programs, Accessories, System Tools, System Monitor (or install it from your Windows operating system CD via the Add/Remove Programs applet in Control Panel). System Monitor displays such real-time statistics as swap file in use, swap file size, and unused physical memory

Select Edit, Add Item, Memory Manager to choose the memory statistics you want System Monitor to display. Unused physical memory, swap file size, and swap file in use can help you estimate which programs have the biggest appetite for Ram. But there’s a way to get a more accurate measure of how much Ram a given program requires. First, determine the amount of memory all your running programs are using by adding the values for ‘Other memory’ and ‘Swappable memory’ in System Monitor. Then subtract the value of ‘Disk cache’. Now close a program and repeat the same steps. The difference is the amount of Random access memory used by the program you just closed.

Windows operating system’ System Resource Monitor is another excellent diagnostic tool for keeping track of your Pc’s memory usage. ‘System resources’ is a 128KB area of memory that current versions of Windows use for compatibility with older apps; if it runs out, Windows operating system displays an ‘out of memory’ error message, even though you may have plenty of free physical or virtual memory on hand. Resource Monitor places a Resource Meter icon in your system tray. Place your mouse over the icon to see the percentage of Windows’ free resources that are available for use, or double-click it to see the amount of available memory as a larger graphic.

If your resources drop below 25 percent, be wary about opening new files and applications. If they drop below 10 %, you’ll see a low memory warning on your screen. At that point, you’re heading toward a system crash. Save your work immediately and close all unnecessary applications and files.

Check for Memory Leaks

Having too many applications or big files open isn’t the only reason for low memory. Sometimes poorly written software programs don’t release blocks of memory when they’re finished using them. Such ‘memory leaks’ add up quickly and can tie up your Ram and/or your system resources.

You can spot these leaks by monitoring Ram use with the System Monitor and Resource Monitor. Watch for programs that don’t return memory to their original levels when you close them. Also, keep an eye on the ‘Threads’ listing in System Monitor. (To view it, choose Edit, Add Item, Kernel, Threads.) Software operations are broken into threads that your Personal computer’s hardware performs. If the number of threads continually increases–especially over the course of minimal computing activity–you’ve probably sprung a leak.

Unfortunately, leaky software isn’t uncommon. If you suspect that a program is leaking memory, check the vendor’s Web site for a fix.

You can also recover Random access memory lost to leaks and unused DLLs with a handy utility called RAMrocket.

Notebook users are frequently on the go and in a hurry. If you use a Personal computer Card to attach a device to your laptop, don’t remove it too quickly when quitting; Windows may still be downloading e-mail to the device, for example, or it may be otherwise using the card. To remove such devices safely, open the Pc Card’s Socket Status dialog box by clicking the Personal computer Card icon in the system tray. Select the Personal computer Card that you want to remove, and click Stop. In a few seconds, Windows operating system will tell you that it’s safe to proceed.

Memory And What To Look For

This article is aimed at understanding how memory works and what to look for when buying it. We also take a look at gaming performance on the Pentium 4 platform and see how different factors such as latency, and frequency can affect it. We also cover DDR and DDR-II memory.

What is Memory?

In its crudest form, memory is a simply a medium for temporary or permanent storage of data. Memory is everywhere, in different sizes, styles, speed and interfaces. Your processor for instance will contain at least two cache memory areas, your graphics card has perhaps a 256MB frame buffer and most people will carry a flash memory device of some sort with them, such as a mobile phone.

When assembling a computer, the two most preeminent types or memory that we need to understand about, are the hard drive and the system memory. The hard drive as covered here, works with a system of spinning platters with the data stored in a magnetic form. This is a non-volatile medium, so when the power is removed from the device, the data stays exactly where it is.

The main system memory is used as a temporary storage space and is volatile. This means that when the computer is switched off, all data is lost. This is one of many reasons why giving Windows a reboot can solve issues, as everything has to be reloaded.

In Windows, you may notice what is referred to as a swap file or virtual memory. This is where the computer extends its system memory into an allocated space on your hard drive. This is a last resort as the hard drive is much slower than the system memory and can have a huge impact on performance. Similarly, the Level 2 cache which is next up in the hierarchy from system memory is even faster and comparatively more expensive.

How does memory work?

Data is stored in bits, which are the simplest form of data possible. They make up the digital era that we are surrounded by. A bit is only ever a 1 or 0, sometimes written as on or off, high or low. Using a sequence of 8 bits, you can make a byte. A byte can therefore give you an 8-Bit number, which is 2^8 or a range of 0-255. This number could represent anything from a colour value in a picture, to an ASCII code for text. The normal rules then apply, with 1024 bytes making a Kilobyte (KB), 1024 Kilobytes making a Megabyte (MB) and 1024 Megabytes making a Gigabyte (GB).

Be sure not to confuse bits and bytes. For instance you might see something written as 11Mb. Because of the lower case ‘b’, this means Megabit, not Megabyte - an easy trap to fall into.

Considering most memory modules are now 512MB, you can imagine there are a lot of these 1bit cells. System memory is based on DRAM (Dynamic Random Access Memory), which is cheaper to make than SRAM, which is mainly used in cache. The further down the memory tier system you go, the slower and cheaper memory gets, with hard drives being the cheapest per megabyte.

With DRAM, at a very basic level each cell is a capacitor that holds a certain amount of charge, much like a bucket holds water. If the bucket is full, it represents a 1. If the bucket is below the half way point or empty, it represents a 0.

If you have ever played chess before, you may have seen people refer to the squares on a chess board in code – such as C4, where C is the column and 4 is the row. In a similar way, you can access a memory cell for reading or writing, except you won’t use letters, you will use a numbered memory address. If this method was used for every single cell in a stick of memory, this would require a lot of wiring and this would increase costs considerably. DRAM gets around this by having a common unit that can address all the rows and another common unit that can address all the columns. Imagine this being like those games you play at the fair ground where you try and catch the cuddly toy with the claw. First you choose your row by moving left or right, then finally choose your column by moving forward or back.

Latencies Explained

The latencies introduced by this system are understandn as the CAS Latency (Column Access Select) and RAS to CAS Delay (Row Access Select) or tCL and tRCD. Of these, the CAS latency has the most impact on performance, as data is usually stored sequentially in a row. For instance, in a lot of cases, the computer will be selecting 8bits at a time to select a whole byte. To do this requires one row select and 8 column selects – that is quite a ratio.

Going back to the bucket example, imagine these buckets have holes in the bottom and slowly leak out water. This introduces yet another problem. To combat this, the capacitors in the cells have to be regularly refreshed, or in the case of a bucket, simply topped up. If the charge/water of a cell holding the value 1 drops below the half way point, the computer won’t know if it was meant to be a 1 or a 0. This is why this refreshing has to be done regularly and quickly in order to keep the data consistent. This unfortunately also introduces another latency called RAS Precharge or tRP.

The final delay that is usually referenced to is the Cycle Time (tRAS), which is how long it takes for the pins to receive a flag and the row to start being selected. The row is always selected before the column.

When you are buying memory, you may see latencies referenced to in 2 ways. One such way is 3-4-4-8. This in order of tCL-tRCD-tRP-tRAS, as described above. The other way is simply C3, CL3 or CAS3. The reason some manufacturers choose the simpler method, is because as explained above – the CAS latency is by far the most important value. Latencies describe delay in clock cycles, so it is important to remember that a lower value is better.

Frequency, Bandwidth and DDR

SDR (Single Data Rate) SDRAM was first introduced as PC66, PC100 and eventually PC133. They run on a 64-Bit bus and can deal with 1bit of data per clock. This gives a theoretical bandwidth for a PC133 module at (64 x 133 x 1) / 8, which is 1064MB/s.

What is now a few years ago, it was decided that this wasn’t adequate bandwidth for modern CPUs. At this point DDR memory was released. This has the ability to deal with 2 bits of data per clock, hence Double Data Rate. This means that 133MHz memory would be running at an effective frequency of 266MHz. When calculated at (64 x 133 x 2) / 8, we get 2128MB/s which is double that of PC133. This is also where the name PC2100 comes from, describing the theoretical bandwidth. This is of course merely marketing.

In almost all real world situations, you will find that the actual bandwidth available is no where near the theoretical bandwidth. This is because the calculation doesn’t take latency into account, something which is impossible to predict as different situations react in different ways to the different latencies.

The recently introduced DDR-II is merely an extension of DDR. Instead of handing 2 bits per clock, it can handle 4. This gives a 133MHz chip an effective frequency of 533MHz and a theoretical bandwidth of (64 x 133 x 4) / 8 = 4256MB/s, which is double that of 266MHz DDR.

So we understand that changing the frequency, and changing the amount of bits per clock that can be dealt with, will change theoretical bandwidth. The final variable that can be changed to affect bandwidth is of course the bus width.

In all the examples above, the bus width has been a fixed 64-Bit. With the introduction of the nForce 2 platform, we saw dual channel memory support. This requires the use of two memory modules in the system, which get run off independent memory controllers. The effect of this is the bus width is doubled and therefore in theory, so is the bandwidth. Using our example above with 133MHz DDR memory, this would now be (128 x 133 x 2) / 8 = 4256MB/s which is in theory the equivalent of single channel DDR-II. This was however implemented quite badly on the nForce 2 platform and makes very little difference at all, unlike implementations on the Athlon 64 platform.

SDR, DDR and DDR-II memory all have different pin counts and are not backwards compatible. Some motherboards will have support for multiple memory types, which gives you a better choice on what memory to use.

FSB and Memory Speed

Traditionally, the memory frequency would always be equal to the front side bus. For instance, a processor running on a 100MHz FSB would have memory running at 100MHz also. If you put 133MHz memory in the system, it would merely run it at a lower speed and no benefit would be seen. nearly all modern boards have the ability to run memory asynchronously to the front side bus, often in both directions. This means you can use both memory that is specified for a higher or lower frequency than the front side bus, although this is specific to motherboard manufacturers desires.

This feature has the added bonus that the 266MHz memory that you invested in not too long ago, may not be quite as useless as you think. Similarly, investing in higher clock speed memory may finally give a performance increase.

If you mix memory speeds (for instance 266MHz CAS 3 and 400MHz CAS 2), the system will run all the memory at the speed and latency of your slowest memory module. Unless you fancy a little overclocking, that is.

ECC and Registered Memory

For a home machine, except in the case of the now obsolete Socket 940 Athlon FX, memory should be unbuffered (i.e not registered), non-ECC memory. These are technologies traditionally saved for servers and some mission critical workstations. But for those who are curious of mind should read on.

Put simply, registered memory has a buffer which holds data before it is passed to the memory to make sure it is in sync. This introduces latency and can also hinder overclocking. Most boards do not support this type of memory, except Opterons, the Socket 940 Athlon 64 FX and most dual CPU and server boards.

ECC stands for Error Correcting Codes. This memory has special circuitry that tests the accuracy of data as it passes to and from the memory. A lot of this checking is based on the principle of parity memory.

With parity memory, for every 8bits (a byte) a 9th bit called the check bit is also stored. The check bit is set according to a simple mathematical calculation. If the number of 1’s in the sequence is even, the parity bit is set to 1, if there are an odd number of 1’s the parity bit is set to 0. Therefore, if one of the bits is corrupted, the check bit will not tally when the calculation is done again. This system is not full proof though, as two bits could be corrupted and the system would let it through. This is why the more advanced ECC memory system was invented. This uses strange groupings such as 7Bits for every 32Bits, allowing it to have more complex calculations.

Unlike parity, ECC can detect when 2, 3 or even 4 bits have been corrupted, but it can only correct a single bit error. On the plus side, it can do this on the fly, without the operating system ever needing to know. This does give a slight performance hit of 2-3%.

Both ECC and registered memory cost more than un-buffered memory and for most readers, should be avoided.