Computer Memory

Key Terms

cache memory
dynamic RAM
RAM
ROM
virtual memory
volatile memory

There are several ways a computer uses memory to keep track of digital information (that is, "0" or "1").

ROM

ROM is a computer's Read Only Memory.  That means it can hold data, but that data cannot be changed.  This type of technology is useful if a chip is designed to do only one thing ...over and over again.  Most microcontroller chips employ this scheme.  And since a computer always boots up using the same instructions, it works there as well.  In fact, ROM can store digital data quite easily.

A simple grid of horizontal and vertical wires is laid out.  At the point of intersection, one of two possibilities exists ... either there is an electrical contact, or there is none.  An electric current down one wire will feed an electric pulse to a horizontal wire (indicating a "1") or it will not (indicating a "0").

How ROM works (animation)
 

ROM memory is very limited in computers because the data stored cannot be changed.  This is a job for RAM memory.

If interested, click link 7.5.a to learn more about ROM.

A better choice...

Your computer is constantly moving data around.  It needs a place to hold data (0's or 1's) so it can quickly access it and make use of it (as long as the system is turned on).  The system also needs to be able to change the digital value stored (zero to one or one to zero) at any time.  This is a job for memory.

Virtual Memory

Probably the least effective way of holding data is by using the hard drive or flash memory.  This is because the CPU access time to the hard drive / flash memory is very slow.  However, the computer will resort to using these devices as memory if in a pinch.  This is called virtual memory.  We will ignore this emergency technique and instead think of the hard drive / flash drive primarily as a "warehouse" for data.

RAM - the backbone of memory

RAM stands for Random Access Memory which simply means that the computer's CPU can access any part of it at any time.  The important thing is that the CPU can get to it quickly so it is not waiting for something to do.  This is where your information goes when you type a term paper, ... not to mention the application software you used to write the paper with (like Microsoft Word), ... or the operating system (Windows) needed to run the application software.

This type of memory has to be able to remember digital information (0 or 1), and be able to change the value it holds at any time.  It must be reliable and provide quick access to the CPU ... the quicker the better.  However, when the power is turned off, all this information is lost (which is why you have to save your work to a disk or other permanent medium).  RAM comes in different types: SDRAM, DDR, RDRAM, etc.  Don't worry about this.  They all do things slightly differently, but they all "remember" digital information.  They come in chipsets which are pushed into slots on the motherboard.  They contain no moving parts (which makes them fast).

Dynamic RAM uses transistors (as switches) and capacitors to hold the data in an electrical form.  This is the cheapest and most common type of memory used by computers today.

Step 1 - You need a switch

The first computers used mechanical relays to open and close a circuit.  This was very slow, but very easy to understand.  Below is an example of how an electromagnet relay can be used to open and close a circuit.   Most of my diagrams use mechanical relays to demonstrate a point because you can physically see a switch open and close which is difficult to show with transistors because there are no moving parts.

A mechanical relay (animation)

Later, vacuum tubes replaced the mechanical relay.  This made the early computers about 1000 times faster, but vacuum tubes produced a lot of heat, consumed a lot of electricity and broke down often.  The transistor replaced the vacuum tube.  It was much smaller, consumed much less electricity, and gave off virtually no heat.  It was also much more reliable and faster.

Transistors

Some call the transistor the greatest invention of the 20th century.  It is an electrical switch and signal amplifier that made desktop computers a reality.

(animation)

When a small voltage is applied to the gate, it acts like a switch and allows current to flow between the source and the drain.  This was covered in a previous unit and is presented here as a review.

Relays, vacuum tubes, and transistors all have the same job in a computer system ... open and close switches.

Step 2 - You need to distinguish a 0 from a 1.  This is done with capacitors.

This capacitor holds a "1" because it is charged.

Basically a capacitor consists of two metal plates which are capable of storing an electric charge.  If it does, the computer considers this the logical state "1".  If the capacitor is not holding a charge, the computer sees this as a "0".

To understand how RAM works, consider the grid below.  It consists of horizontal wires (called address lines) and vertical wires (called data lines).  At each intersection, the horizontal lines connect to a switch (transistor) and the vertical lines to a capacitor.

Since electromagnetic relays are much easier to visualize than transistors (as switching devices) we can show the hardware at each intersection as follows:

Something like this is found at each intersection

Writing the Data

Let's flip this arrangement 90 degrees and show how the system can write data to the capacitors.

 

    Data line

Address line   (animation)

How to write a "0" to the capacitor

First the address line (switch) provides access to the capacitor.  That is, when the address line has current flowing (shown as red), the data line may write to the capacitor.  In the example above, no current flows in the (now horizontal) data line, so the capacitor is uncharged, and the logical value stored is "0".

     Data Line

Address Line (animation)

How to write a "1" to the capacitor

In this example, voltage is supplied to the data line which charges the capacitor.  This is equivalent to the logical value of "1".  It is interesting to note that the capacitor will not hold its charge for a very long time (it naturally drains itself rather quickly), so the system must continually "recharge" the capacitor to maintain the value of "1".  Computer geeks say that this type of memory is volatile, meaning that it will default to zero if electric power is lost or you shut down your computer.  On the other hand, data stored on a flash drive, optical disk (CD, DVD), or hard drive is non-volatile, meaning all those 0's and 1's remain intact until needed.

Reading the Data

When the system needs to "read" a value in RAM, an electric current is sent along the address line (closing the switch).  If the capacitor is holding a charge, current will then flow down the data line telling the system that it was holding a "1".  If no current flows down the data line, the capacitor was uncharged and held a value of "0".

This type of memory is cheap, but requires a lot of maintenance.  The system must constantly monitor the values stored at each location and "recharge" any location holding a "1".  This wastes many cycles in the CPU.  Is there a better way to "remember" data?  You bet!

If interested, click link 7.5.b to learn more about RAM.

Cache Memory

Some blocks of data are used more often (by the CPU) than others.  Any frequently used data should be given the quickest route to the CPU.  Digital engineers developed special chips (called SRAM chips ... or static RAM) to store this information.  This memory is known as cache memory (pronounced cash).  It is more expensive than traditional RAM chips, but much quicker.  It does not need to be "refreshed" because it does not use leaky capacitors to hold the data (although the data is lost when the power is turned off).  It works by using an arrangement of transistors (known as a flip-flop) to hold data.  It is an electric circuit that has two stable states which is used to distinguish between binary "0" and "1".   Data bits are held in an electronic pretzel-like circuit which lets current flow through one side or the other, ...which distinguishes the bit as a "0" or a "1".   It is much like a model train system where the controller can flip a switch and let the train move in one loop or another.  The train will stay in the same tracks until the operator flops the switch the other way.  Although much more efficient, it is also much more expensive than conventional DRAM (dynamic RAM) technology and requires a constant power supply to maintain.  Cache memory is subdivided into categories designated L1, L2, and L3.  A detailed explanation of a flip-flop requires a solid understanding of logical gates and truth tables.  We will provide a brief overview of this in the next section.

A flip-flop used to store data in cache memory Courtesy Arturo Urquizo Wikimedia Commons

Don't worry ... no one will ask you how this works!

If interested, click link 7.5.c to learn more about cache memory.

 

Virtual Memory Uses the system hard drive Used as an emergency backup if RAM gets overworked, very slow
ROM Hot Wired on a chip Used at system boot-up
Dynamic RAM Uses leaky capacitors and transistors This is the workhorse ... cheap but high maintenance
Cache Memory (Static RAM) Uses transistors and logical gates (flip-flop) Expensive and used for high priority tasks by the CPU

©2001, 2004, 2007, 2009, 2016 by Jim Mihal - All rights reserved
No portion may be distributed without the expressed written permission of the author