SlideShare a Scribd company logo
CACHE MEMORY::
MOHD TARIQ
TARIQ.RAIS786@GMAIL.COM
What is cache memory ?
 Cache memory is a small, high speed RAM buffer Located between the CPU and
Main Memory.
 Cache memory holds a copy the instructions (instruction cache) or data (operand a
data cache) currently being used by the CPU.
 The main purpose of a cache memory is to accelerate your computer speed while
keeping the price of the computer low.
Placement of a cache memory:
Fig: Working of cache memory
Magnetic
Disk
Magnetic
Tape
I/O
Processor
Main
Memory
Cache
memory
CPU
Hit Ratio:
 The ratio of the total number of hits divided by the total CPU access to memory(
i.e. hit plus misses) is called Hit Ratio.
 Hit ratio = Total number of Hits / Total number of hits + Total number of
miss.
Example:
 A System with 512 x 12 cache and 32 K x 12 of Main memory
Main
Memory
32 K x 12
CPU
Cache Memory
Types OF Cache Mapping:
1. Direct Mapping
2. Associative Mapping
3. Set Associative Mapping
1. Direct Mapping
i. Each location in RAM has one specific place in cache where the data will be
held.
ii. Consider the cache to be like an array. Part of the address is used as index into
the cache to identify where the data will be held.
iii. Since a data block from RAM can only be in one specific line in the cache, it
must always replace the one block that was already there. There is no need for a
replacement algorithm.
2. Associative Mapping:
I. In associative cache mapping, the data from any location in RAM can be stored
in any location in cache.
II. When the processor wants an address, all tag fields in the cache as checked to
determine if the data is already in the cache.
III. Each tag line requires circuitry to compare the desired address with the tag field.
IV. All tag fields are checked in parallel
3. Set Associative Mapping:
I. Set associative mapping is a mixture of direct and associative mapping.
II. The cache lines are grouped into sets.
III. The number of lines in a set can vary from 2 to 16.
IV. A portion of the address is used to specify which set will hold an address.
V. The data can be stored in any of the lines in the set.
Replacement policy:
 When a cache miss occurs, data is copied into some location in cache.
 With Set Associative or Fully Associative mapping, the system must decide where
to put the data and what values will be replaced.
 Cache performance is greatly affected by properly choosing data that is unlikely to
be referenced again.
Replacement Algorithms of
Cache Memory:
Replacement algorithms are used when there are no available space in a cache in
which to place a data. Four of the most common cache replacement algorithms are
described below:
a) Least Recently Used (LRU): The LRU algorithm selects for replacement the item
that has been least recently used by the CPU.
b) First-In-First-Out (FIFO):The FIFO algorithm selects for replacement the item
that has been in the cache from the longest time.
c) Least Frequently Used (LRU):The LRU algorithm selects for replacement the
item that has been least frequently used by the CPU.
d) Random: The random algorithm selects for replacement the item randomly.
Writing into Cache:
• When memory write operations are performed, CPU first writes into the cache
memory. These modifications made by CPU during a write operations, on the data
saved in cache, need to be written back to main memory or to auxiliary memory.
• These two popular cache write policies (schemes) are:
 Write-Through
 Write-Back
Write-Through:
1. In a write through cache, the main memory is updated each time the CPU writes
into cache.
2. The advantage of the write-through cache is that the main memory always
contains the same data as the cache contains.
3. This characteristic is desirable in a system which uses direct memory access
scheme of data transfer. The I/O devices communicating through DMA receive
the most recent data.
Write-Back:
1. In a write back scheme, only the cache memory is updated during a write
operation.
2. The updated locations in the cache memory are marked by a flag so that later on,
when the word is removed from the cache, it is copied into the main memory.
3. The words are removed from the cache time to time to make room for a new
block of words.
Cache memoy designed by Mohd Tariq

More Related Content

PPT
Cache memory
PPTX
Cache memory
PPTX
Cache memory ppt
PPT
Cache memory presentation
PPTX
Cache memory
PPTX
Memory Technology
PPTX
Cache memory
PPTX
CACHE MEMORY
Cache memory
Cache memory
Cache memory ppt
Cache memory presentation
Cache memory
Memory Technology
Cache memory
CACHE MEMORY

What's hot (20)

PPT
cache memory
PPT
Cache memory
PPTX
Memory Organization
PPTX
Cache memory
PPTX
Multiprocessor architecture
PPTX
Presentation on computer data storage
 
PPTX
computer storage
PPTX
Computer architecture virtual memory
PPTX
Cache Memory.pptx
PPT
Cache Memory
PPTX
Cache memory
PDF
Memory organization
PPS
Cache memory
PPTX
TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER
PPTX
Cache Memory
PPT
Cache
PPT
04 cache memory.ppt 1
PPTX
Cache Memory Computer Architecture and organization
PPTX
Memory devices
PDF
Unit IV Memory and I/O Organization
cache memory
Cache memory
Memory Organization
Cache memory
Multiprocessor architecture
Presentation on computer data storage
 
computer storage
Computer architecture virtual memory
Cache Memory.pptx
Cache Memory
Cache memory
Memory organization
Cache memory
TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER
Cache Memory
Cache
04 cache memory.ppt 1
Cache Memory Computer Architecture and organization
Memory devices
Unit IV Memory and I/O Organization
Ad

Similar to Cache memoy designed by Mohd Tariq (20)

PPTX
cachememppt analyzing the structure of the cache memoyr
PPTX
What is Cache and how it works
PPTX
Cache simulator
PPT
Memory Organization and Cache mapping.ppt
PPT
Memory organization including cache and RAM.ppt
PPTX
Cache Memory.pptx
PPT
Computer organization memory hierarchy
PPTX
2.Cache Memory.pptxoigeyu49-gasdihurovhvhd;oig
PPT
Cpu caching concepts mr mahesh
PPT
Cache Memory for Computer Architecture.ppt
PPTX
cache memory and types of cache memory,
PPTX
Blue and Green Narrative Writing Story Starters Education Presentation _20241...
PPT
Ct213 memory subsystem
PPT
Cache memory by Foysal
PPTX
CPU Caching Concepts
PPT
04 cache memory
PPT
04 cache memory
PPTX
GRP13_CACHE MEMORY ORGANIZATION AND DIFFERENT CACHE MAPPING TECHNIQUES.pptx
PPT
04 cache memory
PPT
cache memory
cachememppt analyzing the structure of the cache memoyr
What is Cache and how it works
Cache simulator
Memory Organization and Cache mapping.ppt
Memory organization including cache and RAM.ppt
Cache Memory.pptx
Computer organization memory hierarchy
2.Cache Memory.pptxoigeyu49-gasdihurovhvhd;oig
Cpu caching concepts mr mahesh
Cache Memory for Computer Architecture.ppt
cache memory and types of cache memory,
Blue and Green Narrative Writing Story Starters Education Presentation _20241...
Ct213 memory subsystem
Cache memory by Foysal
CPU Caching Concepts
04 cache memory
04 cache memory
GRP13_CACHE MEMORY ORGANIZATION AND DIFFERENT CACHE MAPPING TECHNIQUES.pptx
04 cache memory
cache memory
Ad

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Construction Project Organization Group 2.pptx
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
composite construction of structures.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Sustainable Sites - Green Building Construction
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
UNIT 4 Total Quality Management .pptx
PPT
introduction to datamining and warehousing
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
OOP with Java - Java Introduction (Basics)
bas. eng. economics group 4 presentation 1.pptx
Construction Project Organization Group 2.pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
composite construction of structures.pdf
Foundation to blockchain - A guide to Blockchain Tech
Sustainable Sites - Green Building Construction
Mechanical Engineering MATERIALS Selection
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
CYBER-CRIMES AND SECURITY A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
UNIT 4 Total Quality Management .pptx
introduction to datamining and warehousing

Cache memoy designed by Mohd Tariq

  • 2. What is cache memory ?  Cache memory is a small, high speed RAM buffer Located between the CPU and Main Memory.  Cache memory holds a copy the instructions (instruction cache) or data (operand a data cache) currently being used by the CPU.  The main purpose of a cache memory is to accelerate your computer speed while keeping the price of the computer low.
  • 3. Placement of a cache memory: Fig: Working of cache memory Magnetic Disk Magnetic Tape I/O Processor Main Memory Cache memory CPU
  • 4. Hit Ratio:  The ratio of the total number of hits divided by the total CPU access to memory( i.e. hit plus misses) is called Hit Ratio.  Hit ratio = Total number of Hits / Total number of hits + Total number of miss.
  • 5. Example:  A System with 512 x 12 cache and 32 K x 12 of Main memory Main Memory 32 K x 12 CPU Cache Memory
  • 6. Types OF Cache Mapping: 1. Direct Mapping 2. Associative Mapping 3. Set Associative Mapping
  • 7. 1. Direct Mapping i. Each location in RAM has one specific place in cache where the data will be held. ii. Consider the cache to be like an array. Part of the address is used as index into the cache to identify where the data will be held. iii. Since a data block from RAM can only be in one specific line in the cache, it must always replace the one block that was already there. There is no need for a replacement algorithm.
  • 8. 2. Associative Mapping: I. In associative cache mapping, the data from any location in RAM can be stored in any location in cache. II. When the processor wants an address, all tag fields in the cache as checked to determine if the data is already in the cache. III. Each tag line requires circuitry to compare the desired address with the tag field. IV. All tag fields are checked in parallel
  • 9. 3. Set Associative Mapping: I. Set associative mapping is a mixture of direct and associative mapping. II. The cache lines are grouped into sets. III. The number of lines in a set can vary from 2 to 16. IV. A portion of the address is used to specify which set will hold an address. V. The data can be stored in any of the lines in the set.
  • 10. Replacement policy:  When a cache miss occurs, data is copied into some location in cache.  With Set Associative or Fully Associative mapping, the system must decide where to put the data and what values will be replaced.  Cache performance is greatly affected by properly choosing data that is unlikely to be referenced again.
  • 11. Replacement Algorithms of Cache Memory: Replacement algorithms are used when there are no available space in a cache in which to place a data. Four of the most common cache replacement algorithms are described below: a) Least Recently Used (LRU): The LRU algorithm selects for replacement the item that has been least recently used by the CPU. b) First-In-First-Out (FIFO):The FIFO algorithm selects for replacement the item that has been in the cache from the longest time. c) Least Frequently Used (LRU):The LRU algorithm selects for replacement the item that has been least frequently used by the CPU. d) Random: The random algorithm selects for replacement the item randomly.
  • 12. Writing into Cache: • When memory write operations are performed, CPU first writes into the cache memory. These modifications made by CPU during a write operations, on the data saved in cache, need to be written back to main memory or to auxiliary memory. • These two popular cache write policies (schemes) are:  Write-Through  Write-Back
  • 13. Write-Through: 1. In a write through cache, the main memory is updated each time the CPU writes into cache. 2. The advantage of the write-through cache is that the main memory always contains the same data as the cache contains. 3. This characteristic is desirable in a system which uses direct memory access scheme of data transfer. The I/O devices communicating through DMA receive the most recent data.
  • 14. Write-Back: 1. In a write back scheme, only the cache memory is updated during a write operation. 2. The updated locations in the cache memory are marked by a flag so that later on, when the word is removed from the cache, it is copied into the main memory. 3. The words are removed from the cache time to time to make room for a new block of words.