Documentos de Académico
Documentos de Profesional
Documentos de Cultura
The complex subject of computer memory is made more manageable if we classify memory
systems according to their key characteristics. Most important of these are:
ii) Capacity: For internal and external memory, capacity is typically expressed in terms of
bytes. Consider three related concepts for internal memory:
- Unit of transfer
- Word size
- Number of words
iii) Method of accessing units of data. This include
- Sequential access: Memory is organized into units of data, called records. Access
must be made in a sequential linear sequence. Time to access an arbitrary record is
highly variable. Tape units are sequential access.
- Direct access: Individual blocks or records have unique address based on physical
location. Access is accomplished by direct access to general area of desired
information, then some search for final location. Access time is variable, but not as
much as sequential access. Disk units are direct access.
- Random access: Each addressable location has a unique physical location. Access is
direct access to desired location. Access time is constant and independent of prior
accesses. Main memory and some cache systems are random access.
Hierarchy continues with external memory (accessible by processor via an I/O module), with next
level typically being a fixed hard disk.
One or more level below that consisting of removable media such as ZIP cartridges, optical disks
and tape.
Success of the memory hierarchy scheme depends upon locality of reference principle. During
course of execution of a program, memory references, both instructions and data, which tend to
cluster.
- Temporal locality. If a location is referenced, it is likely to be referenced again in near
future.
- Positional locality. When a location is referenced, it is probably close to last location
referenced.
Cache Memory
- Cache memory is intended to give memory speed approaching that of the fastest memories
available, and at the same time provide a large memory size at the price of less expensive
types of semiconductor memories.
- There is a relatively large and slow main memory together with a smaller, faster cache
memory. Cache is in middle of CPU and main memory.
1. Cache address: Almost all processors support virtual memory. If virtual addresses are used, the
system designer may choose to place the cache between the processor and the memory
management unit (MMU) or between the MMU and main memory.
- A logical cache, also known as a virtual cache, stores data using virtual addresses. The processor
accesses the cache directly, without going through the MMU.
-A physical cache stores data using main memory physical addresses.
3. Mapping function: Because there are fewer cache lines than main memory blocks, an algorithm
is needed for mapping main memory blocks into cache lines. Further, a means is needed for
determining which main memory block currently occupies a cache line.
- The choice of the mapping function dictates how the cache is organized. Three techniques
can be used:
4.Replacement algorithms: When all lines are occupied, bringing in a new block requires that an
existing line be overwritten. For direct mapping, there is only one possible line for any particular
block and no choice is possible. For associative and set associative techniques, a replacement
algorithm is required. Algorithms must be implemented in hardware for speed. Four most
common algorithms are:
- Least-recently-used (LRU): The idea is to replace that block in set which has been in cache
longest with no reference to it. Probably most effective method.
- First-in-first-out (FIFO): The idea is to replace that block in set which has been in cache
longest. The implementation uses a round-robin or circular buffer technique.
- Least-frequently-used (LFU): The idea is to replace that block in set which has experienced
fewest references. For implementation, associate a counter with each slot and increment
when used.
- Random: The idea is to replace a random block in set. Interesting because it provides only
slightly inferior performance to an algorithms based on usage.
5. Write policy: If a block has been altered in cache, it is necessary to write it back out to main
memory before replacing it with another block. There are two problems:
- More than one device may have access to main memory. I/O modules may be able to read/write
directly to memory. If a word has been altered only in cache, then corresponding memory word is
invalid or vice versa.
- Multiple CPUs may be attached to same bus, each with their own cache. Then, if a word is
altered in one cache, it could possibly invalidate
There are some techniques to overcome these problems:
i) Write through
- All write operations are made to main memory as well as to cache, so main memory is
always valid.
- Other CPUs monitor traffic to main memory to update their caches when needed.
- This generates large memory traffic and may create a traffic jam.
ii) Write back
- Minimizes memory writes. Updates are done only in cache.
- When an update occurs, an UPDATE bit associated with line is set, so when a block is
replaced it is written back to memory if and only if UPDATE bits is set.
- Portions of main memory are invalid, so accesses by I/O modules must occur through
cache.
- Split cache: One cache is dedicated to instructions and one cache is dedicated to data.
These two caches both exist at the same level, typically as two L1 caches. Trend is toward
split caches particularly for superscalar machines (Pentium). The key advantage of the split
cache design is that it eliminates contention for the cache between the instruction
fetch/decode unit and the execution unit.
Nowadays, the use of semiconductor chips for main memory is almost universal.
Organization
The basic element of a semiconductor memory is the memory cell.
Although a variety of electronic technologies are used, all semiconductor memory cells share
certain properties:
- Exhibit 2 stable (or semi-stable) states which can represent binary 1 or 0.
- Capable of being written into (at least once) to set states.
- Capable of being read to sense states.
Most commonly cell has three functional terminals capable of carrying an electrical signal.
- Select terminal: Selects a memory cell for a read or write operation.
- Control terminal: Indicates read or write.
- Other terminal: For writing, it provides an electrical signal that sets state of cell to 1 or 0.
For reading, it is used for output of cell’s state.
COMPUTER ORGANIZATION: COMP 121: LECTURE 4 Page 6
Semiconductor memory types includes:
Characteristic of RAM
- It is possible both to read data from the memory and to write new data into the memory
easily and rapidly. Both the reading and writing are accomplished through the use of
electrical signals.
- RAM is volatile. A RAM must be provided with a constant power supply. If the power is
interrupted, then the data are lost. Thus, RAM can be used only as temporary storage. The
two traditional forms of RAM used in computers are DRAM and SRAM.
For the write operation, a voltage signal is applied to the bit line; a high voltage represents 1, and a
low voltage represents 0. A signal is then applied to the address line, allowing a charge to be
transferred to the capacitor.
- For the read operation, when the address line is selected, the transistor turns on and the
charge stored on the capacitor is fed out onto a bit line and to a sense amplifier. The sense
amplifier compares the capacitor voltage to a reference value and determines if the cell
contains a logic 1 or a logic 0. The readout from the cell discharges the capacitor, which
must be restored to complete the operation.
- Although the DRAM cell is used to store a single bit (0 or 1), it is essentially an analog
device. The capacitor can store any charge value within a range; a threshold value
determines whether the charge is interpreted as 1 or 0.
Error Correction
Hard failure is a permanent physical defect so that memory cell or cells affected cannot reliably
store data. Hard errors can be caused by manufacturing defects.
Soft Error is a random, non-destructive event that alters contents of one or more memory cells,
without damaging memory. Soft errors can be caused by power supply problems or alpha
particles which result from radioactive decay.
Both hard and soft errors are clearly undesirable and most modern main memory systems include
logic for both detecting and correcting errors.
Example:
When data are to be read into memory, a calculation, depicted as a function f, is performed on the
data to produce a code.
Both the code and the data are stored. Thus, if an M-bit word of data is to be stored and the code is
of length K bits, then the actual size of the stored word is M+K bits.
- A new set of K code bits is generated from M data bits and compared with fetched code bits.
i) Hamming code
The simplest of error-correcting codes is the Hamming code devised by Richard Hamming at Bell
Laboratories.
The figure below uses Venn diagrams to illustrate the use of this code on 4-bit words (M=4).
- 4 data bits (1110) are assigned to the inner compartments. The remaining
- Each parity bit is chosen so that the total number of 1s in its circle is even.
In order to determine the length of the code, the following inequality is used:
2K - 1 ≥ M + K
Example: develop a code that can detect and correct single-bit errors in 8-bit word.
In recent years, a number of enhancements to the basic DRAM architecture have been explored,
and some of these are now on the market.
The schemes that currently dominate the market are SDRAM, DDR-DRAM and RDRAM.
CDRAM has also received considerable attention.
Unlike the traditional DRAM, which is asynchronous, the SDRAM exchanges data with the
processor synchronized to an external clock signal and running at the full speed of the
processor/memory bus without imposing wait states. With synchronous access, the DRAM moves
data in and out under control of the system clock.
The processor or other master issues the instruction and address information, which is latched by
the DRAM. Meanwhile, the master can safely do other tasks while the SDRAM is processing the
request. The DRAM then responds after a set number of clock cycles.
There is now an enhanced version of SDRAM, known as double data rate SDRAM (DDR-SDRAM)
that overcomes the once-per-cycle limitation.
SDRAM is limited by the fact that it can only send data to the processor once per bus clock cycle.
DDR-SDRAM can send data to the processor twice per clock cycle, one on the rising edge of the
clock pulse and one on the falling edge.
DDR2 increases the data transfer rate by increasing the operational frequency of the RAM chip
and by increasing the prefetch buffer from 2 bits to 4 bits per chip. The prefetch buffer is a
memory cache located on the RAM chip. The buffer enables the RAM chip to preposition bits to be
placed on the data base as rapidly as possible.
iv) Cache DRAM (CDRAM)
Integrates a small SRAM cache (16 Kb) onto a basic DRAM chip. The SRAM on the CDRAM
can be used in two ways:
- As a true cache.