Section 5.6
Memory types

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:

  1. Programs, made up of millions of machine instructions, are stored in main memory. The currently running program is always stored in main memory.
  2. Data being operated upon by the running program, both input and output data, are stored in main memory.
  3. Data coming from input devices or going to output devices usually makes a stop in main memory.
  4. In a modern multiprogrammed operating system, programs that are not currently running, but which are ready to run, are stored in main memory.

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 are used to store running programs and the data they work on, while ROMs are used for special programs and unchanging data. When a computer first starts up, a small program called a bootstrap program is read from a ROM and executed. Since ROMs cannot be altered, this bootstrap program cannot be deleted, erased, or harmed in any way. Once the bootstrap starts, it turns on the other components such as the monitor, keyboard, mouse and disk drives, and the real operating system is read from a disk drive. ROMs are also used for many other things, such as character fonts for printers.

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:


Fig. 5.6.1: Capacitors a) shows two plates not touching form a capacitor;
b) end-on view of the plates; c) getting charged by a battery
d) being discharged by attaching a wire to both plates allowing current to flow briefly

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.