Chapter 2
Memory Organization
Computer Organization & Assembly
Programming language
1
Memory Organization
• Memory Hierarchy
• Main Memory
• Cache memory
• Mapping Functions
• Direct Mapping
• Associative Mapping
• Set Associative Mapping
2
Memory Hierarchy
The memory unit is an essential
component in any digital computer since
it is needed for storing programs and
data
Not all accumulated information is
needed by the CPU at the same time
Therefore, it is more economical to use
low-cost storage devices to serve as a
backup for storing the information that
is not currently used by CPU
3
Memory Hierarchy
The memory unit that directly
communicate with CPU is called the
main memory
Devices that provide backup storage are
called auxiliary memory
The memory hierarchy system consists
of all storage devices employed in a
computer system from the slow by high-
capacity auxiliary memory to a relatively
faster main memory, to an even smaller
and faster cache memory
4
Memory Hierarchy
The main memory occupies a central position by
being able to communicate directly with the CPU
and with auxiliary memory devices through an I/O
processor
A special very-high-speed memory called cache is
used to increase the speed of processing by making
current programs and data available to the CPU at
a rapid rate
5
Memory Hierarchy
CPU logic is usually faster than main memory
access time, with the result that processing speed
is limited primarily by the speed of main memory
Overall processing speed of a computer is often limited
by how quickly data can be retrieved from memory
rather than by the speed of the CPU itself.
The cache is used for storing segments of programs
currently being executed in the CPU and temporary
data frequently needed in the present calculations
The access time for cache memory is typically 1 to
7 times faster than main memory (RAM).
Auxiliary memory takes 1000 times longer to
access data from auxiliary memory compared to
RAM.
6
Memory Hierarchy
Main Memory I/O Processor
CPU
Cache
Magnetic
Disks Magnetic Tapes
7
Latency and Bandwidth
The speed and efficiency of data transfers
among memory, processor, and disk have a
large impact on the performance of a
computer system.
Memory latency (Time Delay) – the amount
of time it takes to transfer a word of data to or
from the memory.
The time it takes for data to be fetched from
memory after a request is made.
Lower latency is better because it reduces the
waiting time for the CPU.
Measured in: Nanoseconds (ns)
8
Latency and Bandwidth
Memory bandwidth(Data Transfer Speed)
The amount of data that can be transferred between
the CPU and memory in a given time.
Measured in: Gigabytes per second (GB/s)
Higher bandwidth is better because more data can
be processed at once.
Memory Bandwidth=Data Transfer Rate×Bus Width
×Channels
Data Transfer Rate MHz) –
Determines how many times per second data can be sent.
Measured in Megatransfers per second
Bus Width (How Much Data is Moved at Once)(Bit)-
Determines how many bits of data can be transferred in one
cycle.
Memory Channels (Single, Dual, Quad, etc.)
More channels increase parallel data transfer
If a RAM module has a speed of 3200 MT/s (megatransfers per second)
and a 64-bit data bus, its theoretical bandwidth is:
9
3200×64÷8=25.6 GB/s
Contd..
10
Main Memory
Most of the main memory in a general
purpose computer is made up of RAM
integrated circuits chips, but a portion of the
memory may be constructed with ROM chips
RAM– Random Access memory
RAM are available in two possible operating
modes, Static and Dynamic
ROM– Read Only memory
11
Random-Access Memory
(RAM)
Static RAM (SRAM)
Uses 6 transistors per cell to store a bit.
Retains value indefinitely, as long as it is
kept powered.
Relatively insensitive to disturbances such
as electrical noise.
Faster and more expensive than DRAM.
Dynamic RAM (DRAM)
Uses 1 transistor + 1 capacitor per cell.
Value must be refreshed every 10-100 ms.
Sensitive to disturbances.
Slower and cheaper than SRAM.
12
SRAM vs DRAM Summary
Tran. Access
per bit time Persist? Sensitive? Cost Applications
SRAM 6 1X Yes No 100x cache memories
DRAM 1 10X No Yes 1X Main memories,
frame buffers
13
ROM
ROM is used for storing programs that are
PERMANENTLY resident in the computer and for
tables of constants that do not change in value
once the production of the computer is completed.
The ROM portion of main memory is needed for
storing an initial program called bootstrap loader,
which is to start the computer software operating
when power is turned off
14
Main Memory
A RAM chip is better suited for
communication with the CPU if it has one
or more control inputs that select the chip
when needed
The Block diagram of a RAM chip is shown
next slide, the capacity of the memory is
128 words of 8 bits (one byte) per word
15
RAM
16
Cache memory
If the active portions of the program and data are
placed in a fast small memory, the average memory
access time can be reduced,
Thus reducing the total execution time of the program
Such a fast small memory is referred to as cache
memory
The cache is the fastest component in the memory
hierarchy and approaches the speed of CPU
component
17
Cache memory
When CPU needs to access memory, the cache is
examined
If the word is found in the cache, it is read from the fast
memory
If the word addressed by the CPU is not found in the
cache, the main memory is accessed to read the word
The performance of cache memory is frequently
measured in terms of a quantity called hit ratio
When the CPU refers to memory and finds the word in
cache, it is said to produce a hit
Otherwise, it is a miss
The hit ratio is a measure of how often the CPU finds
the requested data in the cache.Formula
Hit ratio = hit / (hit+miss)
Hits = The number of times the data was found in the cache.
Misses = The number of times the data was not found in the cache and had to
18 be retrieved from main memory.
Cache memory
The basic characteristic of cache memory is its fast
access time,
Therefore, very little or no time must be wasted when
searching the words in the cache
The transformation of data from main memory to cache
memory is referred to as a mapping process, there are
three types of mapping:
Associative mapping
Direct mapping
19 Set-associative mapping
Memory Address Map
Memory Address Map is a pictorial
representation of assigned address space for
each chip in the system
To demonstrate an example, assume that a
computer system needs 512 bytes of RAM and
512 bytes of ROM
The RAM have 128 byte and need seven
address lines, where the ROM have 512 bytes
and need 9 address lines
20
Memory Address Map
21
Memory Address Map
The hexadecimal address assigns a
range of hexadecimal equivalent
address for each chip
Line 8 and 9 represent four distinct
binary combination to specify which
RAM we chose
When line 10 is 0, CPU selects a RAM.
And when it’s 1, it selects the ROM
22
Auxiliary Memory
Magnetic Disk
Optical Disk
RAID Disk
Magnetic Tape
23