Introduction To How Computer Memory Works
Introduction To How Computer Memory Works
RAM
ROM
Cache
Dynamic RAM
Static RAM
Flash memory
Memory Sticks
Virtual memory
Video memory
BIOS
The computer loads the basic input/output Why so many? The answer to this question can
system (BIOS) from ROM. The BIOS teach you a lot about memory!
provides the most basic information about
storage devices, boot sequence, security,
Plug and Play (auto device recognition)
capability and a few other items.
The computer loads the operating system
(OS) from the hard drive into the system's
RAM. Generally, the critical parts of the
operating system are maintained in RAM as Fast, powerful CPUs need quick and easy access to
long as the computer is on. This allows the large amounts of data in order to maximize their
CPU to have immediate access to the performance. If the CPU cannot get to the data it
operating system, which enhances the needs, it literally stops and waits for it. Modern CPUs
performance and functionality of the overall running at speeds of about 1 gigahertz can consume
system. massive amounts of data potentially billions of bytes
When you open an application, it is loaded per second. The problem that computer designers
into RAM. To conserve RAM usage, many face is that memory that can keep up with a 1
applications load only the essential parts of gigahertz CPU is extremely expensive; much
the program initially and then load other more expensive than anyone can afford in large
pieces as needed. quantities.
After an application is loaded, any files that
are opened for use in that application are Computer designers have solved the cost problem
loaded into RAM. by "tiering" memory using expensive memory in
When you save a file and close the small quantities and then backing it up with larger
application, the file is written to the specified quantities of less expensive memory.
storage device, and then it and the
application are purged from RAM. The cheapest form of read/write memory in wide use
today is the hard disk. Hard disks provide large
In the list above, every time something is loaded or quantities of inexpensive, permanent storage. You
opened, it is placed into RAM. This simply means can buy hard disk space for pennies per megabyte,
that it has been put in the computer's temporary but it can take a good bit of time (approaching a
storage area so that the CPU can access that second) to read a megabyte off a hard disk.
information more easily. The CPU requests the data Because storage space on a hard disk is so cheap
it needs from RAM, processes it and writes new data and plentiful, it forms the final stage of a CPUs
back to RAM in a continuous cycle. In most memory hierarchy, called virtual memory.
computers, this shuffling of data between the CPU
and RAM happens millions of times every second. The next level of the hierarchy is RAM. The bit size
When an application is closed, it and any of a CPU tells you how many bytes of information it
accompanying files are usually purged (deleted) can access from RAM at the same time. For
from RAM to make room for new data. If the example, a 16-bit CPU can process 2 bytes at a time
changed files are not saved to a permanent storage (1 byte = 8 bits, so 16 bits = 2 bytes), and a 64-bit
device before being purged, they are lost. CPU can process 8 bytes at a time.
One common question about desktop computers Megahertz (MHz) is a measure of a CPU's
that comes up all the time is, "Why does a computer processing speed, or clock cycle, in millions per
need so many memory systems?" second. So, a 32-bit 800MHz Pentium III can
potentially process 4 bytes simultaneously, 800
Types of Computer Memory million times per second (possibly more based on
pipelining)! The goal of the memory system is to
A typical computer has: meet those requirements.
Level 1 and level 2 caches
Normal system RAM A computer's system RAM alone is not fast enough
Virtual memory to match the speed of the CPU. That is why you
A hard disk need a cache (discussed later). However, the faster
RAM is, the better. Most chips today operate with a
cycle rate of 50 to 70 nanoseconds. The read/write Burst mode is often used in conjunction with
speed is typically a function of the type of RAM pipelining, another means of minimizing the effects
used, such as DRAM,SDRAM, RAMBUS. We will of latency. Pipelining organizes data retrieval into a
talk about these various types of memory later. sort of assembly line process. The memory
controller simultaneously reads one or more words
First, let's talk about system RAM. from memory, sends the current word or words to
the CPU and writes one or more words to memory
System RAM cells. Used together, burst mode and pipelining can
dramatically reduce the lag caused by latency.
System RAM speed is controlled by bus width and
bus speed. Bus width refers to the number of bits So why wouldn't you buy the fastest, widest memory
that can be sent to the CPU simultaneously, and bus you can get? The speed and width of the memory's
speed refers to the number of times a group of bits bus should match the system's bus. You can use
can be sent each second. A bus cycle occurs every memory designed to work at 100 MHz in a 66MHz
time data travels from memory to the CPU. For system, but it will run at the 66MHz speed of the bus
example, a 100MHz 32-bit bus is theoretically so there is no advantage, and 32-bit memory won't
capable of sending 4 bytes (32 bits divided by 8 = 4 fit on a 16-bit bus.
bytes) of data to the CPU 100 million times per
second, while a 66MHz 16bit bus can send 2 bytes Even with a wide and fast bus, it still takes longer for
of data 66 million times per second. If you do the data to get from the memory card to the CPU than it
math, you'll find that simply changing the bus width takes for the CPU to actually process the data.
from 16 bits to 32 bits and the speed from 66 MHz to That's where caches come in.
100 MHz in our example allows for three times as
much data (400 million bytes versus 132 million Cache and Registers
bytes) to pass through to the CPU every second.
Caches are designed to alleviate this bottleneck by
In reality, RAM doesn't usually operate at optimum making the data used most often by the CPU
speed. Latency changes the equation radically. instantly available. This is accomplished by building
Latency refers to the number of clock cycles needed a small amount of memory, known as primary or
to read a bit of information. For example, RAM rated level 1 cache, right into the CPU. Level 1 cache is
at 100 MHz is capable of sending a bit in very small, normally ranging between 2 kilobytes
0.00000001 seconds, but may take 0.00000005 (KB) and 64 KB.
seconds to start the read process for the first bit. To
compensate for latency, CPUs uses a special The secondary or level 2 cache typically resides on
technique called burst mode. a memory card located near the CPU. The level 2
cache has a direct connection to the CPU. A
Burst mode depends on the expectation that data dedicated integrated circuit on the motherboard, the
requested by the CPU will be stored in sequential L2 controller, regulates the use of the level 2 cache
memory cells. The memory controller anticipates by the CPU. Depending on the CPU, the size of the
that whatever the CPU is working on will continue to level 2 cache ranges from 256 KB to 2 megabytes
come from this same series of memory addresses, (MB). In most systems, data needed by the CPU is
so it reads several consecutive bits of data together. accessed from the cache approximately 95 percent
This means that only the first bit is subject to the full of the time, greatly reducing the overhead needed
effect of latency; reading successive bits takes when the CPU has to wait for data from the main
significantly less time. The rated burst mode of memory.
memory is normally expressed as four numbers
separated by dashes. The first number tells you the Some inexpensive systems dispense with the level 2
number of clock cycles needed to begin a read cache altogether. Many high performance CPUs
operation; the second, third and fourth numbers tell now have the level 2 cache actually built into the
you how many cycles are needed to read each CPU chip itself. Therefore, the size of the level 2
consecutive bit in the row, also known as the word cache and whether it is onboard (on the CPU) is a
line. For example: 5111 tells you that it takes five major determining factor in the performance of a
cycles to read the first bit and one cycle for each bit CPU.
after that. Obviously, the lower these numbers are,
the better the performance of the memory.
A particular type of RAM, static random access arithmetic and logic unit (ALU). An integral part of
memory (SRAM), is used primarily for cache. SRAM the CPU itself, they are controlled directly by the
uses multiple transistors, typically four to six, for compiler that sends information for the CPU to
each memory cell. It has an external gate array process.
known as a bistable multivibrator that switches, or For a handy printable guide to computer memory,
flipflops, between two states. This means that it does you can print the HowStuffWorks Big List of
not have to be continually refreshed like DRAM. Computer Memory Terms.
Each cell will maintain its data as long as it has
power. Without the need for constant refreshing, VOLATILITY
SRAM can operate extremely quickly. But the
complexity of each cell make it prohibitively Memory can be split into two main categories:
expensive for use as standard RAM. volatile and non-volatile.
The SRAM in the cache can be asynchronous or Volatile memory loses any data as soon as the
synchronous. Synchronous SRAM is designed to system is turned off; it requires constant power to
exactly match the speed of the CPU, while remain viable. Most types of RAM fall into this
asynchronous is not. That little bit of timing makes a category.
difference in performance. Matching the CPU's clock
speed is a good thing, so always look for Non-volatile memory does not lose its data when
synchronized SRAM. the system or device is turned off. A number of types
of memory fall into this category. The most familiar is
The final step in memory is the registers. These are ROM, but Flash memory storage devices such as
memory cells built right into the CPU that contain CompactFlash or SmartMedia cards are also forms
specific data needed by the CPU, particularly the of non-volatile memory.
Questions:
3. Describe how burst mode and pipelining can dramatically reduce the lag caused by latency?