Chapter 04
Chapter 04
Chapter 04
1
Computer Organization and
CACHE MEMORY
Architecture
NLU-FIT
KEY POINTS
Computer memory is organized into a hierarchy. At
the highest level (closest to the processor) are the
2
the next level typically being a fixed hard disk, and
one or more levels below that consisting of removable
media such as optical disks and tape.
As one goes down the memory hierarchy, one finds
decreasing cost/bit, increasing capacity, and slower
access time.
NLU-FIT
1
05-May-22
CACHE MEMORY
3
Computer Organization and
Architecture
2
05-May-22
bits. External memory capacity is typically
expressed in terms of bytes.
A related concept is the unit of transfer.
For internal memory, the unit of transfer is
equal to the number of electrical lines into
NLU-FIT
bits.
Computer Organization and
3
05-May-22
previous location
e.g. tape
search
Access time depends on location and previous
Architecture
location
e.g. Disk
• Random access:
Individual addresses identify locations exactly
Access time is independent of location or previous
access
e.g. RAM
NLU-FIT
4
05-May-22
5
05-May-22
expensive?
The way out of this dilemma is not to rely
Architecture
on a single memory component or
technology, but to employ a memory
hierarchy.
A typical hierarchy is illustrated in Figure
4.1. As one goes down the hierarchy, the
NLU-FIT
following occur:
b. Increasing capacity
c. Increasing access time
Computer Organization and
6
05-May-22
processor
7
05-May-22
8
05-May-22
9
05-May-22
memory to cache
• Then deliver from cache to CPU
• Cache includes tags to identify which block of
main memory is in each cache slot
Figure 4.5 illustrates the read operation.
NLU-FIT
10
05-May-22
organizations.
• The cache connects to the processor via data,
Computer Organization and
11
05-May-22
cache architectures.
Architecture
NLU-FIT
12
05-May-22
memory physical addresses.
13
05-May-22
14
05-May-22
which main memory block currently
occupies a cache line.
Three techniques can be used: direct,
associative, and set associative.
NLU-FIT
15
05-May-22
i = j modulo m
• where
Computer Organization and
16
05-May-22
fixed cache location for any given block.
Architecture
17
05-May-22
4.3.3.Mapping Function
35
Computer Organization and
Architecture
i= j modulo v
18
05-May-22
19
05-May-22
20
05-May-22
algorithm.
Another possibility is first-in-first-out
(FIFO):
• Replace that block in the set that has been in
the cache longest.
NLU-FIT
(LFU):
• Replace that block in the set that has
Computer Organization and
21
05-May-22
22