Computers rely on different types of memory to store data (this means:
values and addresses). Read-Only Memory (ROM) can only be
read. Random-Access Memory (RAM) can be read and written to. Other
types of memory include EEPROMs, Flash RAM, disks, CD-ROMs, tapes and
so on. Within the scope of these notes, we shall only be concerned
with RAM type memory. This is very fast (in modern PCs RAM chips are
refreshed at frequencies that are around one tenth as that of the
CPU), comparatively expensive, and loses information if the power is
switched off. The model of memory that best fits these C++ notes is
that of a linear array, as depicted in Fig. 1.
Figure 1:
A linear array model of memory: the
-th box has address
and contains value
.
|
RAM can be seen as a long (finite) list of boxes; the
-th box in
the list is addressed by a value
and contains a value
. The
size of an address is usually the same as the processor bus (normally
32 or 64 bit). The size of the value, on the other hand, can be
anything depending on the type of value being stored.
Leo Liberti
2008-01-12