Cache presentation on Mapping and its types

16
Hi, Everyone My Name is: Radhesham Khatri My Presentation Topic Is: CACHE MEMORY

Transcript of Cache presentation on Mapping and its types

Page 1: Cache presentation on Mapping and its types

Hi, Everyone

My Name is: Radhesham Khatri

My Presentation Topic Is:CACHE MEMORY

Page 2: Cache presentation on Mapping and its types

What does Cache mean?The word CACHE means collections of items of same type stored in hidden place.

What does Memory mean?

The ability to remember information, experiences, and people

Page 3: Cache presentation on Mapping and its types

Cache brief:

Small amount of fast memory.

An auxiliary memory from which high speed retrieval is possible.

Sits between normal main memory and CPU May be located on CPU chip or module

Page 4: Cache presentation on Mapping and its types

How Cache Looks :

Page 5: Cache presentation on Mapping and its types

Cache Memory Flowchart

Page 6: Cache presentation on Mapping and its types

Cache Importance :

If the ACTIVE portions of the program and data are place 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 a CACHE

MEMORY.

Page 7: Cache presentation on Mapping and its types

How Cache Looks Like In Mobile Phone:

Page 8: Cache presentation on Mapping and its types

Cache and Main MemoryCPU Cache Main Memory

Hit

Hit Latency

MissMiss

Latency

Mapping

Page 9: Cache presentation on Mapping and its types

Types of Cache Mapping

1 : Direct Mapping

2 : Associative Mapping

3: Set Associative Mapping

Page 10: Cache presentation on Mapping and its types

Cache

Main Memory0123456789101112131415

0123

64 Words

Blocks(4 words)

Lines

16 Words

No of blocks in MAIN MEMORY =64/4 = 16

0 4 8 12

1 5 9 132 6 10 143 7 11 15

No of Lines in CACHE=16/4 = 4

0 0 0 1 0 1

Block No Block offset

50 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

Round Robin Order

0123456789101112131415

0123

Lines

Blocks

Page 11: Cache presentation on Mapping and its types

0 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1

0123456789

101112131415

0 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

Main Memory

0123456789

101112131415

0 4 8 12

1 5 9 132 6 10 143 7 11 15

0123

Binary Representation

Page 12: Cache presentation on Mapping and its types

0 0 0 1 0 1

Block Number Block offset

LineTag

0123

0 01 11 01 1

Tag LINE

0 0 0 0 0 00 0 0 0 0 10 0 0 0 1 00 0 0 0 1 1

Block NumberBlock offsetTag Line

0

1

Main Memory0123456789101112131415

64 Words

0 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

5

0 ,1,2 ,3

1 1 0 1 0 01 1 0 1 0 11 1 0 1 1 01 1 0 1 1 1

Block NumberBlock offsetTag Line

52, 53, 54,55

1 : Direct Mapping

Page 13: Cache presentation on Mapping and its types

0 0 0 1 0 1

Block Number Block offset

LineTag

Main Memory0123456789101112131415

64 Words

0 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

0123

0 01 11 01 1

Tag LINE

Cache

1 : Direct Mapping

One- One

Page 14: Cache presentation on Mapping and its types

A main memory block can load into any line of cache

2 : Associative Mapping Main Memory0123456789101112131415

64 Words

0 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

Cache

0123

16 Words

0 4 8 12

1 5 9 132 6 10 143 7 11 15

0-15

Page 15: Cache presentation on Mapping and its types

Main Memory0123456789

101112131415

64 Words

Blocks(4 words)

0 1 2 34 5 6 78 9 10 1112 13 14 1516 17 18 1920 21 22 2324 25 26 2728 29 30 3132 33 34 3536 37 38 3940 41 42 4344 45 46 4748 49 50 5152 53 54 5556 57 58 5960 61 62 63

Set

MAIN MEMORY size = 64

CACHE Size = 32Block size of Main Memory = 4

0 4 8 12

1 5 9 132 6 10 143 7 11 15

0123

2-way Set Associative

Sets = Lines/ Set SizeSets =8 / 2 = 4 Sets

Lines = Cache size / Block SizeLines = 32 / 4 = 8 Lines

Set Size = 2 Lines

01234567

Set 0

Set 1

Set 2

Set 3

0 0 0 1 0 1

Block Number Block offset

Set NoTag

0 1 1 0 1 1

cc

3 : Set Associative Mapping

Page 16: Cache presentation on Mapping and its types