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

What's hot

Memory organization
Memory organizationMemory organization
Memory organizationAL- AMIN
 
Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coaBharti Khemani
 
Computer organization memory hierarchy
Computer organization memory hierarchyComputer organization memory hierarchy
Computer organization memory hierarchyAJAL A J
 
External memory - Computer Architecture
External memory - Computer ArchitectureExternal memory - Computer Architecture
External memory - Computer ArchitectureBretz Harllynne Moltio
 
Cache memory
Cache memoryCache memory
Cache memoryAnuj Modi
 
Memory organization
Memory organizationMemory organization
Memory organizationDhaval Bagal
 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architectureFaisal Hussain
 
Cache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesCache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesSnehalataAgasti
 

What's hot (20)

Cache memory
Cache memoryCache memory
Cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Cache Memory
Cache MemoryCache Memory
Cache Memory
 
Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coa
 
cache memory
 cache memory cache memory
cache memory
 
Computer organization memory hierarchy
Computer organization memory hierarchyComputer organization memory hierarchy
Computer organization memory hierarchy
 
External memory - Computer Architecture
External memory - Computer ArchitectureExternal memory - Computer Architecture
External memory - Computer Architecture
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache Memory.pptx
Cache Memory.pptxCache Memory.pptx
Cache Memory.pptx
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Cache memory
Cache memoryCache memory
Cache memory
 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architecture
 
Cache coherence ppt
Cache coherence pptCache coherence ppt
Cache coherence ppt
 
Cache Memory- JMD.pptx
Cache Memory- JMD.pptxCache Memory- JMD.pptx
Cache Memory- JMD.pptx
 
Cache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesCache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniques
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
Cache memory
Cache memoryCache memory
Cache memory
 

Similar to Cache memoy designed by Mohd Tariq

lecture-2-3_Memory.pdf,describing memory
lecture-2-3_Memory.pdf,describing memorylecture-2-3_Memory.pdf,describing memory
lecture-2-3_Memory.pdf,describing memoryfloraaluoch3
 
cache memory and types of cache memory,
cache memory  and types of cache memory,cache memory  and types of cache memory,
cache memory and types of cache memory,ashima967262
 
cachememory-210517060741 (1).pdf
cachememory-210517060741 (1).pdfcachememory-210517060741 (1).pdf
cachememory-210517060741 (1).pdfOmGadekar2
 
computerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfcomputerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfssuserf86fba
 
Computer architecture cache memory
Computer architecture cache memoryComputer architecture cache memory
Computer architecture cache memoryMazin Alwaaly
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptxRamanRay105
 
CPU Caching Concepts
CPU Caching ConceptsCPU Caching Concepts
CPU Caching ConceptsAbhijit K Rao
 
CS304PC:Computer Organization and Architecture Session 29 Memory organization...
CS304PC:Computer Organization and Architecture Session 29 Memory organization...CS304PC:Computer Organization and Architecture Session 29 Memory organization...
CS304PC:Computer Organization and Architecture Session 29 Memory organization...Asst.prof M.Gokilavani
 
Cpu caching concepts mr mahesh
Cpu caching concepts mr maheshCpu caching concepts mr mahesh
Cpu caching concepts mr maheshFaridabad
 
IS 139 Lecture 7
IS 139 Lecture 7IS 139 Lecture 7
IS 139 Lecture 7wajanga
 
Computer System Architecture
Computer System ArchitectureComputer System Architecture
Computer System ArchitectureBrenda Debra
 
Memory Organisation in Computer Architecture.pdf
Memory Organisation in Computer Architecture.pdfMemory Organisation in Computer Architecture.pdf
Memory Organisation in Computer Architecture.pdfSangitaBose2
 

Similar to Cache memoy designed by Mohd Tariq (20)

lecture-2-3_Memory.pdf,describing memory
lecture-2-3_Memory.pdf,describing memorylecture-2-3_Memory.pdf,describing memory
lecture-2-3_Memory.pdf,describing memory
 
Cache simulator
Cache simulatorCache simulator
Cache simulator
 
COA (Unit_4.pptx)
COA (Unit_4.pptx)COA (Unit_4.pptx)
COA (Unit_4.pptx)
 
cache memory and types of cache memory,
cache memory  and types of cache memory,cache memory  and types of cache memory,
cache memory and types of cache memory,
 
Cache Memory.pptx
Cache Memory.pptxCache Memory.pptx
Cache Memory.pptx
 
Cache memory
Cache memoryCache memory
Cache memory
 
cachememory-210517060741 (1).pdf
cachememory-210517060741 (1).pdfcachememory-210517060741 (1).pdf
cachememory-210517060741 (1).pdf
 
computerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfcomputerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdf
 
Computer architecture cache memory
Computer architecture cache memoryComputer architecture cache memory
Computer architecture cache memory
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptx
 
CPU Caching Concepts
CPU Caching ConceptsCPU Caching Concepts
CPU Caching Concepts
 
COA
COACOA
COA
 
CS304PC:Computer Organization and Architecture Session 29 Memory organization...
CS304PC:Computer Organization and Architecture Session 29 Memory organization...CS304PC:Computer Organization and Architecture Session 29 Memory organization...
CS304PC:Computer Organization and Architecture Session 29 Memory organization...
 
Cpu caching concepts mr mahesh
Cpu caching concepts mr maheshCpu caching concepts mr mahesh
Cpu caching concepts mr mahesh
 
IS 139 Lecture 7
IS 139 Lecture 7IS 139 Lecture 7
IS 139 Lecture 7
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
Computer System Architecture
Computer System ArchitectureComputer System Architecture
Computer System Architecture
 
Cache memory ...
Cache memory ...Cache memory ...
Cache memory ...
 
Memory Organisation in Computer Architecture.pdf
Memory Organisation in Computer Architecture.pdfMemory Organisation in Computer Architecture.pdf
Memory Organisation in Computer Architecture.pdf
 
CA UNIT V..pptx
CA UNIT V..pptxCA UNIT V..pptx
CA UNIT V..pptx
 

Recently uploaded

NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...Amil baba
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationRobbie Edward Sayers
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf884710SadaqatAli
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdfKamal Acharya
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringDr. Radhey Shyam
 
AI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfAI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfmahaffeycheryld
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industriesMuhammadTufail242431
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopEmre Günaydın
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdfKamal Acharya
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdfAhmedHussein950959
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfKamal Acharya
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxwendy cai
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...Amil baba
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineJulioCesarSalazarHer1
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfAbrahamGadissa
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edgePaco Orozco
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdfKamal Acharya
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdfKamal Acharya
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageRCC Institute of Information Technology
 

Recently uploaded (20)

NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
 
AI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfAI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 

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.