Registers are very fast, but also expensive since they are made up of lots of gates and take up valuable space (affectionately known as "chip real estate"). Computers always need another kind of memory, a much larger area, which is known as main memory.
The main memory of a modern digital computer is where most of the information is stored. Values are brought into the registers of the main processing chip only when they are needed and are stored only briefly.
Following is a list of the things stored in main memory and some of its uses:
In order to speed up computer systems, special memories called caches are often used as temporary holding bins between main memory and the processor chip. We will talk more about these later.
Memories are divided into two types:
RAM | Random Access Memory, any cell can be read or written |
ROM | Read Only Memory, any cell can be read but not written |
RAM memories may be made out of flip-flops, using gates, but this is often too expensive. Such RAM is called SRAM or static RAM because the values in the memory cells stay around (are static) as long as the power is on. Some cache memories used SRAM, but they are both expensive and use a lot of chip real estate.
The main RAM of the computer, the figure heard when a salesperson boasts that this new model has 16 Megabytes of RAM, for instance, is usually of DRAM, or dynamic RAM. This technology breaks a chip surface into millions of small squares which function as capacitors, each storing 1 bit of information.
A capacitor is an electrical component that can temporarily store a small electric charge. If two metal plates are positioned close together, but not touching, they form a capacitor. Fixing one end of a battery to each plate will charge the capacitor, i.e. cause a positive charge to flow into one plate and a corresponding negative charge into the other. If a wire ever connects the two plates, a brief surge of current will flow as the charges equalize. Capacitors are shown in Fig. 5.6.1:
Capacitors on silicon chips used as memories can be interpreted as storing a 1 if the capacitor is charged, 0 if uncharged. Alternately, the positioning of the charges (positive on top or negative on top) could be used to encode 1 or 0.
However, charges leak from capacitors so that eventually the two plates neutralize on their own. The smaller the plates the faster they leak. The tiny capacitors that are built on silicon chips are so small that they leak very rapidly, and hence all the 1s and 0s stored in a DRAM memory would evaporate very soon. Therefore, refresh circuitry is built into these memory chips causing each bit to be read every couple milliseconds and stored afresh so that its 1 or 0 is maintained. This adds complexity to the chip and slows it down.