Академический Документы
Профессиональный Документы
Культура Документы
For Improving
System
Performance
Mechanism For Improving System
Performance
Cache
Mechanism used to buffer frequently used
data from external memory into fast speed
memory.
Pipelining
Mechanism used to overlap the execution of
program statements in order to reduce overall
program execution time.
2
Cache
Technology
Cache Technology Topics
4
Why Cache?
5
Computer With Cache
Data Bus
Cache
Main
Processor Memory
Memory
Address Bus
6
Cache Terminologies
Hit
A condition whereby when an access is made to
obtain a piece of data from memory, the piece of
data is found in the cache.
Miss
A condition whereby when an access is made to
obtain a piece of data from memory, the piece of
data is not found in the cache.
7
Cache Performance
Hit Ratio
The ratio (percentage) in which access to a
piece of data, is successfully found in the
cache.
The effectiveness of a cache can be measured
by looking at the hit ratio and miss ratio, that is,
hit = 1 - miss
8
Can Cache Improve A System's Performance?
Tma = 500ns
9
Can Cache Improve A System's Performance?
Tacc = 95ns 10
Cache Design Consideration
11
Question 1 - Cache Performance
12
Question 2 - Cache Performance
13
Question 3 - Cache Performance
14
Question 4 - Cache Performance
15
Types of Cache Mapping
Main Memory
Cache
• Full Associative Mapping
Mapping
• Set Associative Mapping
16
Cache : Direct Mapping
0
Example of how the main
memory is partitioned based
on the address bus width.
CPU MEMORY
32767
18
Cache : Direct Mapping
15 bits
TAG INDEX
21
Cache : Direct Mapping
n
TAG INDEX
TFS k
22
Cache : Direct Mapping
23
Cache : Direct Mapping
Example
0 0 Cache
512 X 12
Main Memory
Address = 9 bits
32K X 12 511 Data = 12 bits
Address = 15 bits
Data = 12 bits
32767
24
Cache : Direct Mapping
Tag 0
511 511
0 6 Bits 12 Bits
Tag 1
511
Tag Data is
0 Field stored
here
Tag 63
511
12 Bits
25
Cache : Direct Mapping
Question.
26
Address (Tag & Index)
Decimal Form
(Address) Binary Form (Address)
291 000000100100011
Tag Field Index Field
27
Address (Tag & Index)
Decimal Form
(Address) Binary Form (Address)
291 000000100100011
Tag Field Index Field
000000 100100011
28
Address (Tag & Index)
29
Address (Tag & Index)
30
Address (Tag & Index)
31
Cache : Direct Mapping
Tag 0
45 291 0 45 291
511 511
0 6 Bits 12 Bits
Tag 1
511
Memory Index
Address Value
0
Tag 63
511
12 Bits
32
Full Associative Mapping
This is due to the fact that the cache stores the full
memory address of frequently accessed data.
TFS = n
33
Full Associative Mapping
Example:-
If two memory locations are frequently
accessed, that is, memory address 291 (with
content 12) and memory address 803 (with
content 65), what would the computer's
memory and cache look like?
34
Full Associative Mapping
803 65 803 65
15 Bits 12 Bits
36
Set Associative Mapping
Example:-
If two memory locations are frequently
accessed, that is, memory address 291 (with
content 12) and memory address 803 (with
content 65), what would the computer's
memory and cache look like?
37
Address (Tag & Index)
Decimal Binary
Form Form
(Address) (Address)
291 000000100100011
Tag Field Index Field
803 000001100100011
Tag Field Index Field
38
Set Associative Mapping
Tag 0
12 291 0 12 1 65 291
511 511
0 6 Bits 12 Bits 6 Bits 12 Bits
Tag 1 65 803
511
Index
Memory
Value
0 Address
Tag 63
2-Way Set Associative Cache
511
12 Bits
39
Set Associative Mapping
803 65
42
Sample Workings
n = 16
k = 9
43
Sample Workings
= 216
= 65536
44
Sample Workings
= 29
= 512
45
Sample Workings
2n
TAGS = k
2
216
TAGS = 9
2
65536
TAGS =
512
TAGS = 128
46
Sample Workings
TFS = n-k
TFS = 16 - 9
TFS = 7
47
Sample Workings
Tag 0
511 511
0 7 Bits 12 Bits
Tag 1
511
Data is
Tag Field Stored
here
0
What the system would
Tag 127
look like.................
511
12 Bits
48
Question 1 - Cache Mapping
50
Question 3 - Cache Mapping
51
Question 4 - Cache Mapping
52
Question 5 - Cache Mapping
A machine has an address bus width of 16 bits for its main
memory. You have been given that the number of entries within
the cache is 256 entries.
What is the tag field size?
If the cache system were to employ a four-way set-associative
mapping system, what would the system look like?
What is the size (in terms of bits) of a single entry within the cache
if the system stores its data 16 bits in both the main memory and
the cache?
What is the total size of the cache (in terms of both bits and
bytes)?
What is the size of the cache (in terms of both bits and bytes)
from the perspective of the data only?
53
Question 6 - Cache Mapping
You are given that a computer's main memory has an
address bus width of 64 bits. The cache system which
accompanies this computer has an address bus width
of 16 bits.
The cache system that is utilised within this computer is
the direct mapped technique.
If both the main memory and the cache can allow data
of 16 bits to be stored per entry, what is the tag field
size?
Provide an illustration which can clearly depict this
cache system.
54
Question 7 - Cache Mapping
59
Question 12 - Cache Mapping
You are given that a computer system has a total of
67108864 bytes (64MB) of main memory. If each memory
location stores 16bits worth of data and the total number of
TAGs within the main memory is 1024, what is the address
bus width of both the main memory and the cache? What
is the tag field size of the cache? You are also given that
two variables are frequently accessed, memory location
170169 (value 32) and memory location 268473 (value
88).
If the mapping system employed is a 3-way set associative
mapping method, draft out an illustration to depict this
cache mapping system, indicating the variables and its
location within the main memory and the cache.
60
Question 13 - Cache Mapping
You are given that a computer system has a total of
1024 TAGs within the computer's main memory.
The cache mapping method employed is a 4-way
set associative cache mapping technique.
If the computer's main memory and cache have a
data bus width of 16bits and that the main
memory's total capacity is 1048576 bytes, what is
the address bus width of the cache?
Draft out an appropriate and complete illustration to
depict this cache mapping system.
61
Question 14 - Cache Mapping
62