Title: Hierarchical Memory Systems Cache memory
1Hierarchical Memory SystemsCache memory
Chapter 9
- Prof. Sin-Min Lee
- Department of Computer Science
CS147 Lecture 18
2(No Transcript)
3(No Transcript)
4(No Transcript)
5(No Transcript)
6The connection between the CPU and cache is very
fast the connection between the CPU and memory
is slower
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16Cache
- The lowest level of the hierarchy is a small,
high speed memory called cache. - It greatly improves CPU performance.
- It is implemented with Static RAM chips and it
runs at about 5 to 10 ns. - There are two types of cache memory
- A primary cache is located on the CPU chip, it is
small because it competes for space on the CPU
chip.
17(No Transcript)
18(No Transcript)
19The performance of a memory system is defined by
two different measures, the access time and the
cycle time. Access time, also known as response
time or latency, refers to how quickly the memory
can respond to a read or write request. Several
factors contribute to the access time of a memory
system. The main factor is the physical
organization of the memory chips used in the
system. This time varies from about 80 ns in the
chips used in personal computers to 10 ns or less
for chips used in caches and buffers (small, fast
memories used for temporary storage, described in
more detail below).
20The performance of a hierarchical memory is
defined by the effective access time, which is a
function of the hit ratio and the relative access
times between successive levels of the hierarchy.
For example, suppose the cache access time is
10ns, main memory access time is 100ns, and the
cache hit rate is 98. Then the average time for
the processor to access an item in memory is
21(No Transcript)
22(No Transcript)
23(No Transcript)
24(No Transcript)
25(No Transcript)
26(No Transcript)
27- Assume each memory block can only go in one
specific cache block - This is called a Direct Mapped organization.
- The location of the memory block in the cache
(i.e., the block number in the cache) is the
memory block number modulo the number of blocks
in the cache. - For example, if the cache contains 100 blocks,
then memory block 34452 is stored in cache block
52. Memory block 352 is also stored in cache
block 52 (but not at the same time, of course). - In real systems the number of blocks in the cache
is a power of 2 so taking modulo is just
extracting low order bits. - Example if the cache has 16 blocks, the location
of a block in the cache is the low order 4 bits
of block number
28(No Transcript)
29(No Transcript)
30(No Transcript)
31There are three methods in block placement
Direct mapped if each block has only one place
it can appear in the cache, the cache is said to
be direct mapped. The mapping is usually (Block
address) MOD (Number of blocks in cache) Fully
Associative if a block can be placed anywhere
in the cache, the cache is said to be fully
associative. Set associative if a block can
be placed in a restricted set of places in the
cache, the cache is said to be set associative .
A set is a group of blocks in the cache. A block
is first mapped onto a set, and then the block
can be placed anywhere within that set. The set
is usually chosen by bit selection that is,
(Block address) MOD (Number of sets in cache)
32(No Transcript)
33(No Transcript)
34Cache (cont.)
Bits 2-4 of main memory address is the cache
address (index). The upper 5 bits of main memory
(tag) is stored in cache along with data. If tag
and index requested from CPU matches, its a
cache hit.
35(No Transcript)
36(No Transcript)
37(No Transcript)
38(No Transcript)
39(No Transcript)
40(No Transcript)
41(No Transcript)
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47(No Transcript)
48(No Transcript)
49(No Transcript)
50(No Transcript)
51(No Transcript)
52(No Transcript)
53(No Transcript)
54(No Transcript)
55(No Transcript)
56- A pictorial example for a cache with only 4
blocks and a memory with only 16 blocks.
57(No Transcript)
58(No Transcript)
59(No Transcript)
60(No Transcript)
61(No Transcript)
62(No Transcript)
63(No Transcript)