Memory Organization


Typically, a modern personal computer contains several hundred million bytes of memory. The prefix mega (abbreviated M) means million, so we could also say that a computer has several hundred megabytes or MB. Programs and programmers need a way to distinguish one byte from another. This is done by assigning to each byte a unique number, known as the byte's address. Addresses begin at 0. Figure 1.3 shows 4 bytes.


Figure 1.3: Several bytes

If Figure 1.3 showed 512 MB and was drawn to the same scale, it would be about 2,000 miles high.

A single byte is not very versatile, because its value is limited to 256 possibilities. It doesn't matter whether the byte represents a number or a letter or anything else—in computer applications, 256 of anything isn't much of a range. For this reason, computers often use groups of bytes. Two bytes, taken together as a unit, can take on 256 times 256 possible values, or 65,536. Four bytes can take on 256 times 256 times 256 times 256 values, or 4,294,967,296. This is where it starts to be useful. Eight bytes can take on approximately 20 quintillion different values.

Memory is usually used in chunks of 1, 2, 4, or 8 bytes. (Later we will see that arrays and objects use chunks of arbitrary size.) The chunks can represent integral numbers, fractions, text, or any other kind of information. From this perspective, we can see that the statement "Computers only deal with 0s and 1s" is true only in a very limited sense.

Think of it this way: A computer is a digital circuit, and we think of its components as having values that represent 0s or 1s. But if we look one level below the digital components, we see only electricity, not numbers. And if we look one level above the digital components, we see that the bits are organized into chunks of 1 or more bytes that represent many types of information.

In addition to various types of data, memory can also store the instructions that operate on data. In the next section, we will look at a very simple computer and see how instructions and data interact.




Ground-Up Java
Ground-Up Java
ISBN: 0782141900
EAN: 2147483647
Year: 2005
Pages: 157
Authors: Philip Heller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net