This is the second article of the series I am writing about computers. A CPU is the focus of a computer but without Random Access Memory (RAM), it would be harder to use. A CPU has a very small amount of memory to store instructions. If software was limited to that memory, the registers, complex program would not be possible. Other methods can be used to get data into the CPU, but they also bring in limits. The next sections discuss what RAM does and how it affects the computer experience.
How RAM is Used
While the CPU is often viewed as the brain of a computer, it is an incomplete picture. A CPU can process information but it does not store information very well. A separate piece of hardware, RAM is used to store the information, the instructions that the CPU processes. The CPU is connected to the RAM and can read and write the information to it.
RAM is made up of multiple storage locations that each have a separate address. Each address can store a set amount of information. The size of each address space depends on the type of connection it has to the CPU. The smallest amount of information is called a bit. A bit is a single bit of information that can have a value of 0 or 1. These bits are connected together to form a memory location. Eight bits are called a byte. A byte is made of 8 separate bits, each of which can have the value of 0 or 1. By combining these bits and assigning values, different values can be represented. The values are interpreted by using the Base 2 numbering system. I will cover numbering for computers in more detail in a later article.
A byte, eight bits, can represent 256 unique combinations. In processors that are larger than eight bits, a combination of bytes makes a word. For a 16 bit processor, two bytes make a word, a 32 bit processor has words of four bytes and a 64 bit processor has RAM made up of 8 byte words. The bit number for a processor refers to the number of bits it can store in one register of the CPU. The register locations are used to store the address for a location in RAM and the information that is read/written to RAM.*
As the number of addresses for RAM became larger, it became easier to develop a new unit of measure, a kilobyte, to measure the RAM. A kilobyte is made of 1,024 bytes. So a 16 bit computer, with maximum RAM would hold 64 kilobytes (KB) of memory locations. When we refer to a long distance we say five miles instead of 26,400 feet or 8,800 yards. It is easier to remember and say five. For RAM, it is the same principle. As the numbers became larger, the units of megabytes and gigabytes are now used to describe the amount of RAM in a computer. A megabyte contains 1,024 kilobytes and a gigabyte contains 1,024 megabytes. The number 1,024 is used instead of 1,000 because it is the value of 2^10 power. Since computers use the base 2 numbering system, the units are also calculated in base 2. Some people will use 1,000 to estimate the number of bytes, to get an estimate, but the estimate will not be for a full kilobyte.
RAM is used for multiple purposes in computers. The most familiar usage is storing a computer program that the CPU executes. Another use is storing the information that is displayed on your monitor. A page of memory can be set aside and the bits toggled to display information that is readable by people. RAM can also store input received from the keyboard, mouse, game controller, scanner or other input device. All of the information has to be translated from human readable formats into numbers that can be expressed in the base 2 numbering system. For the early computer systems, each computer manufacturer developed their own translation table. This meant that software and text on one computer would not be compatible with another computer.
In the 60's, a standard was developed based on the tables used by several companies. The result was the American Standard Code for Information Interchange (ASCII). This standard mapped letters of the English alphabet, such as found on a typewriter to set values. At first it only included upper case letters, eventually lower case letters were added . The table is a map of the upper and lower case letters of the English alphabet, the digits 0-9 and some special characters, such as !, #, $ and other characters that were in use on typewriters and teletype machines. There are also some other characters that are not human readable but provide special instructions to a computer. Examples are the symbols for a carriage return or a line feed. They provide an instruction for the computer to finish a block of text and start a new line. These non-readable characters are used to improve readability or communication with the computer.
The list of characters was kept short due to the limited memory of the times. This created problems when people wanted to display text from other languages. When there was limited RAM, multiple languages would be mapped on top of the same tables. Eventually RAM was cheap enough that a larger amount could be used to store mapped characters. Now the Unicode Transformation Format (UTF) can use a larger set of numbers and is used to map the characters of multiple languages.
The size of the addressable RAM effects the maximum date and time stored in the computer. The date and time are stored in different formats depending on how the date and time will be accessed and displayed. For software created before the year 2000, many programs limited the storage of the year from 4 characters to 2 characters to save space. As time went on, it was realized that 4 characters should be used to display the year in order to show the different between centuries. These types of problems can show up decades earlier due to projects for things like mortgages. When the number grows too larger, there is an overflow. This can cause the dates to be displayed as years since 1900 and lead to incorrect representation of the date.
The date and time in computers has also stored as the number of milliseconds since January 1, 1970. This is a more accurate way to store the date and time. However, with this method, the maximum date that can be stored is 19 January 2038 in 32 bit computers. The problem is corrected by using a 64 bit computer. A 64 bit value for the date and time will allow dates of up to 290 billion years from now. For computers that are limited to 32 bits or less for date and time, they may experience what is called the Year 2038 problem.
RAM also stores the data that is temporarily stored before it is written to more permanent storage such as a hard drive, CD-ROM or USB drive. Each software program has a stack of memory that it uses to store this temporary data. In older languages, the memory wasn’t always managed well and could be overwritten by other software programs or possibly the operating system. When this overwriting occurred, it could lead to strange errors or that dreaded error, the blue screen of death. Much of the work of patching software is finding where memory is getting overwritten or written with invalid values and adding a check to prevent the overwrites. It seems to work most of the time, I very rarely see a complete crash of software or the operating system.
RAM is not permanent, software is only remembered for as long as there is power for the computer. I suspect everyone has had experience with a sudden power loss and the loss of data when the computer turned off.
How RAM Shapes the Computer Experience
All of the information stored in RAM can be eventually broken down to a collection of ones and zeros. There isn’t any shading on the value of the numbers, the base values can only have two possible values. In the real world, the information could have multiple values that exist somewhere between zero and one. When the information is based on this definite set of values, it is called digital data. Information that can have differing values can be called analog data. An example of analog data is a vinyl record. The music is recorded in grooves that can vary in depth and could potentially vary slightly when copied. If the microphones and recording equipment are of high quality, they can record a large amount of data from a song and record all of the slight differences in a record. The data is recorded not just in values of 0 or 1, but in ranges of values. More of the music is recorded than is possible to record on a computer.
The same song recorded on a computer, is stored digitally. All of the music is stored as a series of zeros and ones that are decoded to sound like music. Not all of the tonal qualities are stored. For most people, they cannot tell the difference of analog versus a digital recording but there are some people who do notice a difference. The music is recorded with parts missing in it. Some of these parts are not important, such as the hiss and pops from a vinyl record. Other parts might be important and require additional hardware and software to compensate for the missing values for the music.
With only two base values available for storing data, this means that data can take up a lot of space. The data also needs to be translated to make it easier for a person to read, listen to or view. For example, to store the letter A, it must be translated from an ‘A’ to a number stored in the ASCII table. This number is then changed to a binary number to fit in the RAM. So a capital A becomes the number 65. This number becomes 0100 0001 in base two, which requires one byte of storage. This paragraph, up to this sentence, is 490 characters, including spaces and punctuation. This would require 490 bytes to store the paragraph. For an a slightly large novel of approximately 82,000 words, it could contain around 423,326 characters which would require 423,326 bytes of storage. That would require 413 KB of space in RAM. For us now, that doesn't seem like much RAM. For an old Apple II, with the maximum memory of 48KB, the entire story would not have fit into the RAM of the time. There are ways to work around these limits and early software often had complicated code to increase the capacity of the computer.
RAM is also used to display information on the monitor of a computer. With early computers, the display information used up part of the RAM of the system. Now we have graphic cards that include RAM on them for the display. Since the information is stored in bytes, the information is translated into colors on our screens. The standard of Red Green Blue (RGB) is used to store the values for each pixel on the screen. An RGB value takes two bytes to store the information. In earlier computers, less RAM was used for color display. With few bits used, there were fewer colors. Microcomputers started off with sixteen colors. As RAM became cheaper, more bits were allocated for colors. Now the use of RGB in a byte, allows the display of 16.7 million different colors for each pixel. By mixing the pixels, a rich color set can be displayed on monitors. Displaying graphics can require a lot of CPU time to generate objects based on formulas. This led to the development of separate cards, just for graphic display. These cards have their own processor and RAM that are used to generate and display graphics. This frees up RAM on the computer for the software processing.
The limits of RAM have led to the need for fixes for date and time values. Modern computers that have 64 bit processors and RAM can support dates that are far in the future. However, there are many older computers used in business for vital functions that do not have the newer processors. Analysis is occurring on the scope and cost of the possible problems.
The use of RAM with a CPU solves the problem of speeding up a computer and supporting larger software applications. However, if the power is turned off, all of the software and data is lost. The software has to be loaded into the computer each time it is booted. The next article will go over the storage of software on media such as punch cards, paper tapes, cassette tapes, floppy drives, hard drives, USB sticks, and CD/DVD-ROM discs.
*Notes
I am breaking out the numbers associated with RAM in order to make the text a bit more readable.
Addressable RAM by bits of CPU
The number of addressable memory locations for each type of processor is listed below. These numbers may be rounded down by manufacturers when they advertise the size of RAM or hard drives. In the past computers did use addressing schemes in the processor for support of larger amounts of RAM. The early 8086 processors are examples of using multiple 8 bit registers and building an address from them. With larger registers, it reduces the complexity required to use larger amounts of RAM. Reducing complexity reduces the overall maintenance costs of code developed for a computer.
- 8 bits - 2^8 - 256 bytes
- 16 bits - 2^16 - 65,536 bytes
- 32 bits - 2^32 - 4,294,967,296 bytes
- 64 bits - 2^64 - 18,446,744,073,709,551,616 bytes
Units used for measuring computer RAM
- 1 Kilobyte (kB) - 1,024 bytes
- 1 Megabyte (MB) = 1,048,576 bytes
- 1 Gigabyte (GB) = 1,073,741,824
- 1 Terabyte (TB) = 1,099,511,627,776 bytes
Using Units for Maximum RAM
- 16 bits
- 64 KB
- 32 bits
- 4,194,304 KB
- 4,096 MB
- 4 GB
- 64 bits
- 18,014,398,509,482,000 KB
- 17,592,186,044,416 MB
- 17,179,869,184 GB
- 16,777,216 TB
At this point in time, a 64 bit processor is adequate for current software needs. In the future there may be a 128 bit processor, which would support addressing a lot of RAM. The other option that is being explored is the use of quantum memory, qubits, for computers. Either path would be pursued to support large scale mathematical processing for things like simulations of real world events, or encryption. I suspect both options are in experimental stages right now. I may research this further in the future to see where things stand in this area.
Pictures by J.T. Harpster.
- Log in to post comments