Chapter 03
Chapter 03
Computer Memory
CHAPTER 03
2
• Key characteristics
Overview • Memory hierarchy
• Locality of reference
3
Key characteristics
4
Memory Hierarchy
Design constraints: How much (capacity) , how fast (access time),
how expensive (cost),
Memory Hierarchy
• Locality of references
• Cache mapping schemes
Cache • Replacement policies
memory • Cache write policies
7
Locality of reference
If a memory location X is accessed at time t, there is a high
probability that memory location X + 1 will also be accessed in the
near future → locality of reference.
Three basic forms:
Temporal locality - Recently accessed items tend to be accessed again in
the near future.
Spatial locality - Accesses tend to be clustered in the address space (for
example, as in arrays or loops).
Sequential locality - Instructions tend to be accessed sequentially.
The locality principle provides the opportunity for a system to use a
small amount of very fast memory to effectively accelerate the
majority of memory accesses. Typically, only a small amount of the
entire memory space is being accessed at any given time, and
values in that space are being accessed repeatedly.
8
The size of cache memory can vary and can be organized into
multiple levels.
Direct mapping
12
Direct Mapping
Advantage: Simple and inexpensive to implement.
Associative mapping
Any block of main memory can be placed anywhere in the cache
memory.
The fastest and most flexible mapping technique.
18
Set-Associative mapping
Cache blocks are divided into sets. Set size is in the power of 2
Example: the cache has 2 blocks --> 2-way set associative, the cache
has 4 blocks --> 4-way set associative
19
L2 (unified)
I-Cache & D-Cache
256 KB, 8-way, 11 cycles
L3 (unified)
8 MB, 16-way, 30-40 cycles
23
Organization
The basic element of a semiconductor memory is the memory cell
which are:
Two stable states, which can be used to represent binary 1 and 0.
Capable of being written into (at least once), to set the state.
Capable of being read to sense the state.
25
Types of ROM
ROM contain permanent pattern of data that can not be changed.
EPROM (Erasable PROM): read and write electrically (old data must
be erased by exposing the package to an intense UV radiation).
Types of RAM
DRAM (Dynamic RAM): is made with cells that store data as charge
on capacitors. Because capacitors have a natural tendency to
discharge →require periodic charge refreshing to maintain data.
SRAM (Static RAM): is a digital device that uses the same logic
elements used in the processor. In a SRAM, values are stored using
traditional FF logic-gate → hold its data as long as power is supplied.
Chip Logic
Semiconductor memory comes in
packaged chips. Each chip
contains an array of memory cells.
The array is organized into W
words of n bits each.
Overall Structure
34
• Magnetic disk
External • Solid State Drives
Memory • Optical Memory
37
Construction
A disk is a circular platter constructed of nonmagnetic material,
called the substrate, coated with a magnetizable material.
Construction
For most disks, the magnetizable coating is applied to both sides of
the platter (double sided). Some less expensive disk systems use
single-sided disks.
Performance parameters
Seek time: the time required to move the disk arm to the required
track = Startup time + Traverse time + Settle time.
For common disk size today (3.5’ = 8.9 cm), typical average seek time
is under 10ms.
Transfer time:
41
Timing comparison
Consider a disk with an advertised average seek time of 4 ms,
rotation speed of 15,000 rpm, and 512-byte sectors with 500 sectors
per track. Suppose that we wish to read a file consisting of 2500
sectors for a total of 1.28 Mbytes.
Timing comparison
Consider a disk with an advertised average seek time of 4 ms,
rotation speed of 15,000 rpm, and 512-byte sectors with 500 sectors
per track. Suppose that we wish to read a file consisting of 2500
sectors for a total of 1.28 Mbytes.
Timing comparison
Consider a disk with an advertised average seek time of 4 ms,
rotation speed of 15,000 rpm, and 512-byte sectors with 500 sectors
per track. Suppose that we wish to read a file consisting of 2500
sectors for a total of 1.28 Mbytes.
RAID
The rate of improvement in secondary storage performance has
been considerably less than the rate for processors and main
memory.
The mismatch has made the disk storage system, the main focus of
concern in improving overall computer system performance ➔ using
parallel components (multiple disks)
45
RAID
Industry has agreed on a standardized scheme for multiple-disk
database design, known as RAID (Redundant Array of Independent
Disks). RAID scheme consists of 7 levels (0 → 6). All levels share three
common characteristics:
• Flash memory
Solid State • SSD
Drive (SSD) • Practical issues with SSD
50
Flash memory
Type of semiconductor memory that has been around for a number
of years and is used in many consumer electronic products (smart
phones, GPS devices, MP3 players, digital cameras, USB devices…)
In recent years, the cost and performance of flash memory has
evolved to the point where it is feasible to use flash memory drives to
replace HDDs.
Flash memory
In NAND flash memory, the basic unit is 16 or 32 bits, and the logical
organization resembles NAND devices.
NAND reads and writes in small blocks. It is used in USB flash drives,
memory cards (in digital cameras, MP3 players, etc.), and in SSDs.
NAND provides higher bit density than NOR and greater write speed.
Lower power consumption: SSDs use as little as 2.1 watts of power per
drive, considerably less than comparable-size HDDs.
Lower access times and latency rates: Over 10 times faster than the
spinning disks in an HDD
53
Practical issues
Tend to slow down as the device is used
Flash memory is accessed in blocks (size of 512 KB), there are typically
128 pages per block.
1. The entire block must be read from the flash memory and placed in a
RAM buffer. Then the appropriate page in the RAM buffer is updated.
2. Before the block can be written back to flash memory, the entire
block of flash memory must be erased—it is not possible to erase just
one page of the flash memory.
3. The entire block from the buffer is now written back to the flash
memory
54
Practical issues
Becomes unusable after a certain number of writes
As flash cells are stressed, they lose their ability to record and retain
values (typical limit is 100,000 writes)
55
• Compact Disk
Optical • CD Recordable
Memory • CD Rewritable
• Digital Versatile Disk
56
CD Recordable (CD-R)
For CDs and CD-ROMs, information is recorded by the pitting of the
surface of the medium, which changes reflectivity.
For a CD-R, the medium includes a dye layer. The dye is used to
change reflectivity and is activated by a high-intensity laser.
58
CD Rewritable (CD-RW)
The CD-RW optical disk can be repeatedly written and overwritten,
as with a magnetic disk.
The phase change disk uses a material that has two significantly
different reflectivities in two different phase states:
Amorphous state, in which the molecules exhibit a random orientation
that reflects light poorly;
Crystalline state, which has a smooth surface that reflects light well.
A beam of laser light can change the material from one phase to
the other.
Bits are packed more closely on a DVD: The spacing between loops
of a spiral on a CD is 1.6 μm, the minimum distance between pits
along the spiral is 0.834 μm. The DVD uses a laser with shorter
wavelength and achieves a loop spacing of 0.74 μm and a
minimum distance between pits of 0.4 μm (4.7GB)
Dual-layer DVD (8.5GB): the lasers in DVD drives can adjust focus to
read a semireflective layer on top of the reflective layer.