About Computer Memory ¶
This section focuses on general-purpose memory, where PCs store programs and data that are currently in use, the pipeline that supplies data to and receives results from the processor. General-purpose memory, called read-write memory or Random Access Memory (RAM), must be readable-from and writable-to. Two types of RAM are used on modern PCs:
Dynamic RAM ¶
Dynamic RAM (DRAM) stores data for only a tiny fraction of a second before losing it. To maintain stored data, the system must constantly refresh DRAM, which exacts a performance penalty and limits its speed. Typical DRAM provides 60 ns (nanosecond) access, but is inexpensive and consumes relatively little power.
Static RAM ¶
Static RAM (SRAM) automatically maintains its contents as long as power is applied to it, without requiring refresh. SRAM provides access times an order of magnitude faster than DRAM, but is expensive and power-hungry.
PCs use a tiered memory architecture that takes advantage of these characteristics:
Main memory ¶
The bulk of a PC's memory uses DRAM (modern systems use a variant called SDRAM, described in the next section) and is called main memory. It is large typically 256 MB to 1 GB or more but too slow to keep up with a modern CPU. Main memory is where the CPU stores programs and data that it will soon need. Main memory functions as a buffer between the CPU and disk.
Cache memory ¶
Cache memory is a small amount of fast SRAM that buffers access between the CPU and main memory.
Modern PCs have two layers of cache memory:
Primary cache memory ¶
Primary cache memory, also called Level 1 cache or L1 cache, is typically 16 to 128 KB of very fast memory on the same chip as the CPU itself. L1 cache size and efficiency are major factors in CPU performance. The amount and type of L1 cache is determined by the CPU you use, and cannot be upgraded.
Secondary cache memory ¶
L1 cache is not large enough to eliminate the speed disparity between processors and main memory. Secondary cache memory, also called Level 2 cache or L2 cache, bridges that gap with a reasonable compromise between cost and performance. L2 cache is a part of the CPU package (or of the CPU substrate itself) on all modern processors, including the Intel Pentium 4 and Celeron, and the AMD Athlon 64 and Sempron. Modern processors have L2 cache memory sizes ranging from 128 KB to 2 MB.
TAKE THE CACHE AND RUN
The amount of cache memory present on a processor can have a dramatic impact on performance, particularly if you work on small data sets. For example, when we tested the SETI@Home (http://setiathome.ssl.berkeley.edu/) client on two nearly identical processors, one with 512 KB of L2 cache and the other with 1 MB, the second processor completed work units in less than half the time required by the first. That was true because the entire work unit fit within the 1 MB L2 cache, but not within the 512 KB L2 cache. Running a similar distributed processing application that used data sets too large to fit in the 1 MB L2 cache, the processor with the larger L2 cache was only marginally faster. If you are choosing between two similar processors, always choose the one with the larger L2 cache.
Memory types ¶
Recent systems use main memory of one of the following types:
Synchronous DRAM ¶
Synchronous DRAM, also called SDRAM, began shipping in 1996 and was commonly used on PCs until 2001. Unlike older and now obsolete asynchronous forms of memory, SDRAM shares a common clock reference with the CPU. The CPU and memory are slaved together, allowing the CPU to transfer data to and from memory whenever it wishes to do so, rather than requiring the CPU to await an arbitrary window. SDRAM speeds are specified in MHz rather than in nanoseconds, as was true of earlier forms of memory. Synchronous DRAM takes one of the following forms:
JEDEC SDRAM ¶
JEDEC SDRAM or PC66 SDRAM is so-called to differentiate it from the later PC100 SDRAM and PC133 SDRAM.
PC100 SDRAM ¶
PC100 SDRAM is rated for use with Pentium II and Pentium III processors that use the 100 MHz FSB.
PC133 SDRAM ¶
PC133 SDRAM is rated for use on a 133 MHz FSB. Note that you cannot safely assume that PC133 memory can be used to upgrade a system that has PC66 or PC100 memory installed. Some systems, particularly those based on the Intel 440BX and 810-series chipsets require PC100 memory and will not function properly with PC133 memory installed.
In general, although PC66, PC100, and PC133 SDRAM modules are still available (although in limited distribution), any system that uses SDRAM is a poor upgrade candidate. The latest SDRAM systems are now more than five years old, and reaching the end of their service life. The fastest SDRAM systems, such as 1+ GHz Pentium III models, are still fast enough to serve in secondary roles, but the very high cost per megabyte of SDRAM makes it uneconomic to upgrade them other than by salvaging SDRAM memory from other old systems.
Relative to standard SDRAM, Double Data Rate SDRAM (DDR-SDRAM) doubles the amount of data transferred per clock cycle, and thereby effectively doubles peak memory bandwidth. DDR-SDRAM is an evolutionary improvement of standard SDRAM, which is now sometimes called Single Data Rate SDRAM or SDR-SDRAM to differentiate it. Because DDR-SDRAM costs essentially the same to produce as SDR-SDRAM, it quickly obsoleted SDR-SDRAM.
The chips used to produce a DDR-SDRAM memory module, called a DIMM (Dual In-line Memory Module) are named for their operating speed. For example, 100 MHz chips are double-pumped to 200 MHz, and so are called DDR200 chips. Similarly, chips that operate at 133 MHz are called DDR266 chips, those that operate at 166 MHz are called DDR333 chips, and those that operate at 200 MHz are called DDR400 chips.
Unlike SDR-SDRAM DIMMs, which are designated by their chip speeds, DDR-SDRAM DIMMs are designated by their bandwidth.
Their data path is 64 bits (8 bytes) wide. So, for example, a DDR-SDRAM DIMM that uses DDR200 chips transfers 8 bytes 200 million times per second, for a total bandwidth of 1,600 million bytes/second and is called a PC1600 DIMM. Similarly, DDR-SDRAM DIMMs that use DDR266 chips are labeled PC2100, those that use DDR333 chips are labeled PC2700, and those that use DDR400 chips are labeled PC3200.
The falling price of PC3200 DDR-SDRAM modules quickly obsoleted slower forms of DDR-SDRAM, although PC2700 modules remain in limited distribution. The limited availability of PC2100 and slower forms of DDR-SDRAM is not an issue for systems that use those slower variants, because PC3200 memory is backward-compatible with slower variants.
Faster Isn't Necessarily Better
High-performance memory modules targeted at gamers, overclockers, and other enthusiasts are available with ratings of PC3500, PC4000, PC4200, and higher. These premium-price modules provide no benefit unless you are overclocking a system beyond its rated speed.
DON'T MIX AND MATCH
Mixing faster modules with slower modules causes the faster memory to run at the speed of the slowest module installed. Also, some motherboards don't deal well with memory of mixed speeds. If you are upgrading a system that has a limited amount of slower DDR-SDRAM and the processor can take advantage of the higher speed of PC3200 DDR-SDRAM, it often makes sense to replace the slower modules rather than simply adding the PC3200 modules.
Any system that uses DDR-SDRAM is a good upgrade candidate. If it is not labeled, you can identify the speed and other characteristics of an DDR-SDRAM DIMM by checking the item number on the module on the manufacturer web site. DDR-SDRAM DIMMs use 184 pins and can be discriminated from 168-pin SDR-SDRAM and 240-pin DDR2-SDRAM memory modules by noting the number of pins and the position of the single keying notch. Figure 6-2 shows a DDR-SDRAM DIMM.
Figure 6-2: A DDR-SDRAM DIMM
DDR2 SDRAM ¶
By early 2003, the original DDR-SDRAM technology was fast approaching its limits. As AMD and Intel transitioned to higher FSB speeds, DDR-SDRAM has been hard pressed to keep pace. Mainstream DDR-SDRAM tops out at PC3200. Dual-channel DDR chipsets (which combine the bandwidth of paired memory modules) using PC3200 memory limit peak bandwidth to 6,400 MB/s. That matches the bandwidth requirements of a processor with a 64-bit (8-byte) wide memory channel operating with an 800 MHz FSB, such as mainstream Pentium 4 models, but as new processors are introduced, even dual-channel DDR-SDRAM will be unable to keep up with increases in processor bandwidth.
The long-term solution is DDR2 SDRAM. DDR2 incorporates a series of evolutionary improvements on standard DDR technology, including increased bandwidth, lower voltage (1.8V versus the 2.5V of DDR), lower power consumption, and improved packaging. Just as DDR-SDRAM doubled bandwidth over SDR-SDRAM when running at the same clock rate, DDR2-SDRAM doubles bandwidth over DDR-SDRAM by doubling the speed of the electrical interface. DDR2 DIMMs use a new 240-pin connector that is incompatible with the 184pin DDR-SDRAM and earlier connectors. Table 6-1 lists the important characteristics of DDR2-SDRAM, with PC3200 (DDR400) DDR-SDRAM shown for comparison.
Table 6-1: DDR2 characteristics
Although Intel has pushed DDR2 hard since its introduction, initial uptake was slow for two reasons. First, DDR2 memory originally sold at a very high premium over DDR memory, sometimes as much as 200% to 300%. By late 2005, that differential had dropped to 15% or 20%, making DDR2 a more reasonable choice. Second, although DDR2 offers much higher bandwidth than DDR, it also suffers from much higher latency. In effect, that means that although DDR2 can deliver data at higher speed than DDR, it takes longer to start delivering the data. For applications that use primarily sequential memory access, such as video editing, the bandwidth advantage of DDR2 offers noticeably higher memory performance. For applications that access memory randomly, including many personal productivity programs, the latency advantage of DDR gives it the edge. DDR2-SDRAM DIMMs use 240 pins and can be discriminated from 168-pin SDR-SDRAM and 184-pin DDR-SDRAM memory modules by noting the number of pins and the position of the keying notch.
Rambus RDRAM ¶
Rambus RDRAM is a proprietary RAM standard developed jointly by Intel and Rambus. Rambus RDRAM is packaged in modules called RIMMs, which is a tradename rather than an acronym.
There are three types of RDRAM memory, called Base Rambus, Concurrent Rambus, and Direct Rambus. The first two are obsolete, and were used only in devices like game consoles. All RDRAM memory used in PCs is Direct Rambus memory. RDRAM has been made in four speeds, designated PC600, PC700, PC800, and PC1066, although only PC800 and PC1066 remain available. As with DDR-SDRAM, RDRAM modules are named according to their bandwidth, but with a difference. RDRAM uses a 16-bit or 18-bit data path (versus 64-bit for SDRAM) to transfer two bytes at a time, versus the 8-byte bandwidth of DDR-SDRAM. Accordingly, PC800 RDRAM has a bandwidth of only 1.6 GB/s and PC1066 2.133 GB/s, much lower than that of DDR-SDRAM, let alone DDR2-SDRAM.
TWO MODULES IN ONE
RDRAM RIMMs were originally supplied as 16-bit or 18-bit parts. In dual-channel RDRAM motherboards, those modules had to be installed in pairs, one per channel. Currently available PC1066 32/36-bit RDRAM RIMMs are in effect two 16- or 18-bit RIMMs combined into a single package, and can be installed singly in dual-channel RDRAM systems.
RDRAM also suffers from severe latency, and that latency increases as the number of RDRAM devices is increased. Although RDRAM offered potentially higher overall performance at the time it was introduced, faster and much less expensive DDR-SDRAM quickly obsoleted RDRAM for use in desktop systems. RDRAM-based systems are upgradable, barely, but weigh carefully the age of the system and the cost of additional RDRAM memory versus the cost of replacing the motherboard and using DDR-SDRAM or DDR2-SDRAM memory.
RAMBUS ISN'T FOR PCS ANYMORE
Rambus introduced a follow-on to RDRAM called XDR DRAM, which is competitive in performance (if not in price) with DDR-SDRAM. XDR DRAM is used in the Sony PlayStation 3 game console, but no existing PC chipset supports XDR DRAM. All of the PCs that were built with Rambus memory are now near the end of their design service life.
You can judge the type of memory likely to be present in a system by knowing that system's age. Figure 6-3 shows a timeline for the types of memory that have been installed in new systems over the last 10 years.
Figure 6-3: Types of memory used in new systems by year
As of late 2005, the memory landscape for PCs appears to be predictable for the next couple of years. PC3200 DDR-SDRAM memory will continue to be used in low-end systems, and will remain widely available for those who are upgrading older systems. DDR2-SDRAM finally gained a foothold in 2005 for Intel-based systems, and as AMD introduces DDR2-compatible processors throughout 2006, DDR2 will become the mainstream memory technology, gradually replacing DDRSDRAM.