next up previous contents
Next: Exercises Up: Data Representation Previous: Representing Programs

Memory Organization

We've seen how sequences of binary digits can be used to represent numbers, characters, and instructions. In a computer, these binary digits are organized and manipulated in discrete groups, and these groups are said to be the memory of the computer.

Units of Memory

The smallest of these groups, on most computers, is called a byte . On nearly all currently popular computers a byte is composed of 8 bits.

The next largest unit of memory is usually composed of 16 bits. What this unit is called varies from computer to computer- on smaller machines, this is often called a word , while on newer architectures that can handle larger chunks of data, this is called a halfword .

The next largest unit of memory is usually composed of 32 bits. Once again, the name of this unit varies- on smaller machines, it is referred to as a long , while on newer and larger machines it is called a word .

Finally, on the newest machines, the computer also can handle data in groups of 64 bits. On a smaller machine, this is known as a quadword , while on a larger machine this is known as a long .

Historical Perspective

There have been architectures that have used nearly every imaginable word size- from 6-bit bytes to 9-bit bytes, and word sizes ranging from 12 bits to 48 bits. There are even a few architectures that have no fixed word size at all (such as the CM-2) or word sizes that can be specified by the operating system at runtime.

Over the years, however, most architectures have converged on 8-bit bytes and 32-bit longwords. An 8-bit byte is a good match for the ASCII character set (which has some popular extensions that require 8 bits), and a 32-bit word has been, at least until recently, large enough for most practical purposes.

Addresses and Pointers

Each unique bytegif of the computer's memory is given a unique identifier, known as its address. The address of a piece of memory is often refered to as a pointer to that piece of memory- the two terms are synonymous, although there are many contexts where one is commonly used and the other is not.

The memory of the computer itself can often be thought of as a large array (or group of arrays) of bytes of memory. In this model, the address of each byte of memory is simply the index of the memory array location where that byte is stored.

Summary

In this chapter, we've seen how computers represent integers using groups of bits, and how basic arithmetic and other operations can be performed using this representation.

We've also seen how the integers or groups of bits can be used to represent several different kinds of data, including written characters (using the ASCII character codes), instructions for the computer to execute, and addresses or pointers, which can be used to reference other data.

There are also many other ways that information can be represented using groups of bits, including representations for rational numbers (usually by a representation called floating point), irrational numbers, graphics, arbitrary character sets, and so on. These topics, unfortunately, are beyond the scope of this chapter.


next up previous contents
Next: Exercises Up: Data Representation Previous: Representing Programs

Dan Ellard
Mon Jul 21 22:30:59 EDT 1997