Professional Documents
Culture Documents
Memory Systems
Memory Systems
CHAPTER 4
MEMORY SYSTEM DESIGN
Out line
2
Location
Processor
Internal (Main)
External (Secondary)
Capacity
Word Size
Number of Words
Unit of Transfer
Word
Block
Characteristics of a Memory System
4
Access Method
Sequential (Tape)
◼ Start at the beginning and read through in order
◼ Access time depends on location of data and previous location
Direct (Disk)
◼ Individual blocks have unique address
◼ Access is by jumping to vicinity plus sequential search
◼ Access time depends on location of data and previous location
Random (RAM/ROM)
◼ Individual addresses identify locations exactly
◼ Access time is independent of location or previous access
Characteristics of a Memory System
5
Performance
Access Time
◼ Time between presenting the address and getting the valid
data
Cycle Time
◼ Time may be required for the memory to “recover” before
next access
◼ Cycle time is access + recovery
Transfer Rate
◼ Rate at which data can be moved
Characteristics of a Memory System
7
Physical Type
Semiconductor
◼ RAM / ROM
Magnetic
◼ Disk & Tape
Optical
◼ CD & DVD
Magneto-Optical
◼ CD-RW
Characteristics of a Memory System
8
Physical Characteristics
Volatile/ Non-Volatile
Erasable / Non-Erasable
Power Consumption
Organization
Physical arrangement of bits into words
◼ Not always obvious
Memory Hierarchy
9
Three rules:
Faster access time, greater cost per bit.
Greater capacity, slower access time.
Greater capacity, smaller cost per bit.
Volatile.
Used for temporary storage only.
If the power is disconnected, the contents become invalid.
SRAM
Chip
Organization
Read Only Memory (ROM)
19
Used for:
Microprogramming.
System programs.
Whole programs in embedded systems.
Library subroutines and function tables.
Constants.
Non volatile.
Can be programmed - written into - only once.
Non volatile.
More expensive than PROM.
Electrically Erasable PROM (EEPROM)
23
Non volatile.
Updatable in place.
More expensive and less dense than EPROM.
Flash Memory
24
Organization of
the 256 K Byte
System
Each chip receives all 18 bits
of the address.
Each chip produces/receives
a single bit of the data.
Memory Module Organization
30
Relatively large and slow main memory together with faster, smaller
cache.
Cache contains a copy of portions of main memory.
When processor attempts to read a word from memory, a check is
made to determine if the word exists in cache.
If it is, the word is delivered to the processor.
If not, a block of main memory is read into the cache, then the word is delivered
to the processor.
Word Block
Transfer Transfer
CPU Cache
Memory
Main
Memory
Hit Ratio
35
0
1
Block 2 Block
Tag
(K words)
0
1
2
3
.
.
C-1
.
Block Length
(K Words)
Cache Main
2n - 1
Memory
Word Length
Main Memory and Cache Memory
37
Size
Mapping function
Replacement algorithm
Write policy
Line size
Number of caches
Elements of Cache Design...
39
Cache Size
◼ Small enough ---not to be costly or expensive
◼ Large enough so overall average access time is small
◼ Affected by the available chip and board area
Elements of Cache Design...
40
Mapping Function
No of cache lines <<< No of blocks in main memory
Mapping function needed
◼ A method to map main memory blocks into cache lines
Three mapping techniques used
Direct
Associative
Set Associative
… …
Direct Mapping
Address Structure
Tag s-r Line or Slot r Word w
8 14 2
Tag Line or Slot Word
24 bit address
2 bit word identifier (4 byte block)
22 bit block identifier
◼ 8 bit tag (=22-14)
◼ 14 bit slot or line
No two blocks in the same line have the same Tag field
Reading From a Direct Mapped
45
System
The processor produces a 24 bit address.
The cache uses the middle 14 bits to identify one of
its 16 K lines.
The upper 8 bits of the address are matched to the
tag field of the cache entry.
If they match, then the lowest order two bits of the
address are used to access the word in the cache line.
If not, address is used to fetch the block containing the
specified word from main memory to the cache.
Elements of Cache Design...
46
Advantages.
Simple.
Inexpensive to implement.
Disadvantages.
There is a fixed location for each block in the cache.
◼ Ifa program addresses words from two blocks mapped to
the same line, the blocks have to be swapped in and out of
cache repeatedly.
Associative Mapping
49
16 Mbytes of memory.
24 bits in address.
4 byte blocks.
2 bits.
Rest is used to identify the block mapped to the
line. 22 2
Tag Word
Reading From an Associative Mapped System
52
Advantages.
Improves hit ratio for certain situations.
Disadvantages.
Requiresvery complicated matching hardware for
matching the tag and the entries for each line.
◼ Expensive.
Set Associative Mapping
55
16 Mbytes of memory.
24 bits in address.
4 byte blocks.
Lowest order 2 bits.
8K sets in a 2-way associative cache.
13 bits.
Rest is used to identify the block mapped to the
line.
9 13 2
Tag Set Word
Reading From a Set Associative Mapped System
58
Advantages.
Combines advantages of direct and associative
mapping techniques.
Disadvantages.
Increasing the size of the set does not always improve
the hit ratio.
2-way set associative has a much higher hit ratio than direct
mapping.
Increasing it to 4-way improves the hit ratio slightly more.
Beyond that no significant improvement has been seen.
Replacement Algorithms
61
Direct mapping.
No choice.
Memory blocks map into certain cache lines.
◼ The entry occupying that line must be swapped out.
Replacement Algorithms
62
First-in
First-out (FIFO).
Least Recently Used (LRU).
Write-back.
Write-Through
64
Advantage.
Memory and cache are always in sync.
Disadvantage.
Memory write becomes slow.
Write-Back
65
Advantage.
Reduces memory traffic because a word may be
updated several times while in cache.
Disadvantage.
Cache and memory will be out of sync for a while.
What about DMA??
Number of Caches
66
On-Module Cache.
◼ CPU uses a dedicated, internal, fast, memory bus to access
cache.
On-Mother-Board Cache.
◼ The CPU has to use the system bus to get to it.
◼ Still much faster than DRAM based main memory.
Cache Strategy
70
Removable
Optical
CD-ROM
CD-Recordable (CD-R)
CD-R/W
DVD
Magnetic Tape
Magnetic Disk
Disk substrate coated with magnetizable material (iron
oxide…rust)
Substrate used to be aluminium
Now glass
Improved surface uniformity
◼ Increases reliability
Reduction in surface defects
◼ Reduced read/write errors
Lower flight heights (See later)
Better stiffness
Better shock/damage resistance
How Hard Drive works?
74
See video
Read and Write Mechanisms
Recording & retrieval via conductive coil called a head
May be single read/write head or separate ones
During read/write, head is stationary, platter rotates
Write
Current through coil produces magnetic field
Pulses sent to head
Magnetic pattern recorded on surface below
Read (traditional)
Magnetic field moving relative to coil produces current
Coil is the same for read and write
Read (contemporary)
Separate read head, close to write head
Partially shielded magneto resistive (MR) sensor
Electrical resistance depends on direction of magnetic field
High frequency operation
Higher storage density and speed
Inductive Write MR Read
Data Organization and Formatting
Concentric rings or tracks
Gaps between tracks
Reduce gap to increase capacity
Flying (Winchester)
Fixed/Movable Head Disk
Fixed head
One read write head per track
Heads mounted on fixed ridged arm
Movable head
One read write head per side
Mounted on a movable arm
Removable or Not
Removable disk
Can be removed from drive and replaced with another
disk
Provides unlimited storage capacity
Nonremovable disk
Permanently mounted in the drive
Multiple Platter
One head per side
Heads are joined and aligned
Aligned tracks on each platter form cylinders
Data is striped by cylinder
reduces head movement
Increases speed (transfer rate)
Multiple Platters
Tracks and Cylinders
Floppy Disk
8”, 5.25”, 3.5”
Small capacity
Up to 1.44Mbyte (2.88M never popular)
Slow
Universal
Cheap
Obsolete?