CH 6 Coa
CH 6 Coa
CH 6 Coa
Memory Organization
Introduction
Memory in a computer system can be divided into two main classes: main store and secondary
store. Main store is the high speed memory used to hold the programs and data currently in use.
Secondary store is the memory used for long term storage of data, e.g. a disk drive. This section
discusses main store - the next deals with secondary store.
Computer memory is made of a number of cells (one per bit), each of which can exist in two
distinct states corresponding to the value of some physical property. Cells are often grouped
together to form words. Each cell has an address which allows it to be uniquely specified.
Different physical properties can be used to store the information. The following are commonly
used methods.
Computer memory can also be classed according to the method of access to the cells. Random
access memory is arranged so that the time taken to read or write any cell is the same, regardless
of its location. Main memory is random-access. Note however, that the term random access
memory (RAM) is often used to refer only to the read-writable main memory used for short term
data storage. Serial access memory is arranged so that the time taken to access a particular cell is
dependent is dependent on the physical location of the cell, and usually depends on the position
of the last cell accessed. Tape drives are serial access devices.
We can also classify memory according to whether or not we can modify the cell contents. Read
only memory (ROM) is memory whose contents cannot be modified. This may either be
semiconductor memory, or a read-only device such as an ordinary optical disk (CD-ROM). The
core of a computer's operating system is often stored in semiconductor ROM.
1
Memory Hierarchy
Memory Hierarchy is to obtain the highest possible access speed while minimizing the total cost
of the memory system Computer systems always combine several different types of the memory
devices discussed above. This is because none alone can provide all the required characteristics.
Ideally computer memory should be the following.
a) Very fast
b) Small
d) Robust and non-volatile (remember its contents even when switched off)
e) Cheap
Magnetic disk
2
3
Internal CPU memory
This is very fast. However, it is bulky, expensive, consumes a lot of power, and the contents are
lost when power is removed.
Main store
Relatively fast, but still bulky, expensive and volatile.
Magnetic disk
These can store large quantites of data cheaply and in a small space. Furthermore,
these can be used for permament/semi-permanent storage, as the data is not lost when
power is removed. However, the access time is much slower than main memory.
4
Magnetic tape and optical storage
These are both very cheap and can store huge quantities of data in a small space. Typically they
use removable media, and so are ideal for permanent storage of data. However, access times are
extremely long.
By combining different types of memory in a single system, the designer can get the best of all
worlds and build a relatively low cost system with a high capacity and a speed almost that of a
huge main memory.
All of the memory used as main store in a modern computer is implemented as semiconductors
fabricated on wafers of silicon. Semiconductor memory is fast and easy to use. To fulfill the
needs of modern computer systems it is becoming increasingly dense (more bits per chip) and
cheap.
A semiconductor memory chip consists of a large number of cells organised into an array, and
the logic necessary to access any array in the cell easily. Semi-conductor memory may be classed
according to the mechanism used by each cell to store data.
The simplest type of memory is called static memory. In static memory each cell uses a flip-flop
made from four or six transistors. The data in each cell is remembered until the power is
switched off. Static memory is easy to use and reliable, but is relatively bulky, slow and
expensive.
Most computer systems therefore use dynamic memory as their main store. Dynamic memory
uses just a single transistor per cell, and is therefore denser, faster and cheaper. Unfortunately
each cell gradually forgets the data stored in it, and so extra circuitry must be used to continually
refresh the cells.
Memory Organisation
This section looks at how the various components of a computer's main memory are arranged.
An n-bit address bus allows us to uniquely refer to up to 2n different memory locations. Often
these memory locations are imagined laid out in a column, known as the address space. Various
5
regions of the address space are then grouped into blocks to form a memory map. The blocks
may refer to hardware (i.e. physical RAM and ROM devices), or to logical entities (i.e.
programs, data, etc.).
Cache Memory
Although semiconductor memory is fast, typically it takes longer for the CPU to access main
memory than to execute simple instructions. We can get around this problem by taking
advantage of locality of reference. Typically when executing a program, memory accesses over a
short interval tend to be to similar memory locations. Most modern computer systems therefore
use a small amount of very fast memory between the CPU and main memory, known as cache
memory. Whenever the CPU needs to access main memory, the cache is first checked to see if
the data is stored there. If it is, then main memory need not be accessed. If it is not, then it is
fetched from main memory and placed in the cache, together with the data nearby, in the hope
that this will also be needed soon. In this way, accesses to main memory can be greatly reduced
(typically reduced to less than 10%).
We have already seen that CPU memory is faster than main memory, but is very expensive, and
takes up a lot of room on a chip which is already likely to be fairly densely packed. Many
systems therefore use a two-stage cache design, using a small amount of on-chip cache memory,
and a larger external cache.
6
7
Virtual memory
8
9
10
11
12
13
14