SlideShare a Scribd company logo
1 of 30
Cache Memory
E048-Shailesh Tanwar
E061-Yash Nair
E017-Shairal Neema
E019-Aashita Nyati
Agenda
 Memory Hierarchy
 What is Cache Memory
 Working of Cache
 Structure of Cache
 Cache Write Policies
 Levels of Cache
 Cache Organization
 Mapping techniques
 Replacement algorithms
Memory Hierarchy –
Diagram
Decreasing cost per bitIncreasing capacityIncreasing access timeDecreasing frequency of
access of the memory by
the processor
What is Cache Memory?
 Cache memory is used in order to achieve higher performance of CPU by
allowing the CPU to access data at faster speed.
 It is placed closest to the processor in the computer assembly.
 It is way too costly.
 It is also a type of memory but keeping in mind the cost factor it cannot be
used as a primary memory.
AN INSIGHT INTO THE WORKING OF CACHE
Structure of the Cache memory
Contains address of actual
data fetched from Main Memory
Contains actual data fetched
From the Main Memory
Cache write policies
When we write ,should we write to cache or memory?
 Write through cache – write to both cache and main memory.
Cache and memory are always consistent.
 Write back cache – write only to cache and set a “dirty bit”. When
the block gets replaced from the cache ,write it out to memory.
Levels of Cache
Fastest Fast
Less Fast
Slow
Cache Organization
Address
Address
buffer
Control Control
Data
Data
buffer
System bus
Mapping Techniques
Direct mapping
Associative mapping
Set associative mapping
Direct mapping
Simplest technique
In this , each block of main memory is mapped into
only one possible cache line .
i = j modulo m
where , i= cache memory
j= main memory
m=no. of lines in the cache
Address length = (s + w) bits
Number of addressable units = 2^(s+w) words or
bytes
Block size = line size = 2w words or bytes
Number of blocks in main memory = 2^(s+
w)/2^w = 2s
Number of lines in cache = m = 2^r
Size of tag = (s – r) bits
ASSOCIATIVE MAPPING
It overcomes the disadvantage of direct
mapping.
It permits each main memory block to be
loaded into any line of the cache .
Address length = (s + w) bits
Number of addressable units = 2^(s+w)
words or bytes
Block size = line size = 2^w words or bytes
Number of blocks in main memory =
2^(s+ w)/2^w = 2^s
Number of lines in cache = undetermined
Size of tag = s bits
SET ASSOCIATIVE MAPPING
 The relationship which is followed here is
m= v*k
i= j modulo v
Where ,
i= cache set no.
j= main memory
m= no. of lines in the cache
v= no. of set
k= no. of lines in each set
This is called k-way set associative mapping .
Address length = (s + w) bits
Number of addressable units = 2s+w words
or bytes
Block size = line size = 2^w words or bytes
Number of blocks in main memory = 2^s
Number of lines in set = k
Number of sets = v = 2d
Number of lines in cache = kv = k * 2d
Size of tag = (s – d) bits
Replacement algorithms
Discard itemsAdd new ones
Cache Memory
Cache Full…
Replacement algorithms
 Optimizing instructions.
 To manage cache information on computer.
 In direct mapping.
Each block only maps to one cache block .
 Associative and set associative mapping.
 Least recently used(LRU)
 First in first out(FIFO)
 Least frequently used(LFU)
 Random
Replacement algorithms
Least Recently used
 The most effective.
 Keeps track of which block used when.
 Discards the least recently used blocks first.
USE bit
0
USE bit
1
2 3 4 2 1 3 7
1 2 3 4 5 6 7
2 2 2 2 2 2 7
3 3 3 1 1 1
4 4 4 3 3
EXAMPLE
Page hit
1
Page fault
3
7
First In First Out
 The simplest algorithm.
 Bad performance.
 First entering block, is discarded first.
 Replaces the block that has been in cache the longest.
2 3 4 2 1 3 7
1 2 3 4 5 6 7
2 2 2 2 1 1 1
3 3 3 3 3 3
4 4 4 4 7
EXAMPLE
Page hit Page hit
1
7 Page fault
Least Frequently Used
 Counts how often a block is needed.
 Every block has one counter of its own which is initially
set to 0.
 As the block is referenced, the counter is incremented.
 Replaces the lowest reference frequency block.
2 3 4 2 1 3 7
1 2 3 4 5 6 7
2 2 2 2 2 2 2
3 3 3 3 1 1
4 4 4 4 3
EXAMPLE
Page hit
1 7
Page fault
I I I II I I I
3
Random
 Randomly selects a block.
 Discards it to make space.
 Does not keep track of access history.
 This eliminates the overhead cost of tracking page
references.
Thank You

More Related Content

What's hot

Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)Sandesh Jonchhe
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
Register organization, stack
Register organization, stackRegister organization, stack
Register organization, stackAsif Iqbal
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Cache memory principles
Cache memory principlesCache memory principles
Cache memory principlesbit allahabad
 
Cache memory
Cache memoryCache memory
Cache memoryAnuj Modi
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptxRajapriya82
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache designRohail Butt
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208Ameer Mehmood
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Cache memoy designed by Mohd Tariq
Cache memoy designed by Mohd TariqCache memoy designed by Mohd Tariq
Cache memoy designed by Mohd TariqMohd Tariq
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory ManagementAkmal Cikmat
 

What's hot (20)

Stack organization
Stack organizationStack organization
Stack organization
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
 
04 Cache Memory
04  Cache  Memory04  Cache  Memory
04 Cache Memory
 
Memory mapping
Memory mappingMemory mapping
Memory mapping
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Register organization, stack
Register organization, stackRegister organization, stack
Register organization, stack
 
cache memory
 cache memory cache memory
cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Cache memory principles
Cache memory principlesCache memory principles
Cache memory principles
 
Cache memory
Cache memoryCache memory
Cache memory
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Cache memory
Cache memoryCache memory
Cache memory
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptx
 
Cache mapping
Cache mappingCache mapping
Cache mapping
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache design
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Cache memoy designed by Mohd Tariq
Cache memoy designed by Mohd TariqCache memoy designed by Mohd Tariq
Cache memoy designed by Mohd Tariq
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
 

Similar to Cache memory

CACHEMAPPING POLICIE AND MERITS & DEMERITS
CACHEMAPPING POLICIE AND MERITS & DEMERITSCACHEMAPPING POLICIE AND MERITS & DEMERITS
CACHEMAPPING POLICIE AND MERITS & DEMERITSAnkitPandey440
 
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptx
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptxwaserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptx
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptxabcxyz19691969
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer ArchitectureSubhasis Dash
 
9.1-CSE3421-multicolumn-cache.pdf
9.1-CSE3421-multicolumn-cache.pdf9.1-CSE3421-multicolumn-cache.pdf
9.1-CSE3421-multicolumn-cache.pdfrishav957243
 
Cache.pptx
Cache.pptxCache.pptx
Cache.pptxVCETCSE
 
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docxECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docxtidwellveronique
 

Similar to Cache memory (20)

CACHEMAPPING POLICIE AND MERITS & DEMERITS
CACHEMAPPING POLICIE AND MERITS & DEMERITSCACHEMAPPING POLICIE AND MERITS & DEMERITS
CACHEMAPPING POLICIE AND MERITS & DEMERITS
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptx
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptxwaserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptx
waserdtfgfiuerhiuerwehfiuerghzsdfghyguhijdrtyunit5.pptx
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer Architecture
 
9.1-CSE3421-multicolumn-cache.pdf
9.1-CSE3421-multicolumn-cache.pdf9.1-CSE3421-multicolumn-cache.pdf
9.1-CSE3421-multicolumn-cache.pdf
 
module3.ppt
module3.pptmodule3.ppt
module3.ppt
 
memory.ppt
memory.pptmemory.ppt
memory.ppt
 
memory.ppt
memory.pptmemory.ppt
memory.ppt
 
Cache memory
Cache memoryCache memory
Cache memory
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache recap
Cache recapCache recap
Cache recap
 
Cache.pptx
Cache.pptxCache.pptx
Cache.pptx
 
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docxECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
 

Recently uploaded

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 

Recently uploaded (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 

Cache memory

  • 1. Cache Memory E048-Shailesh Tanwar E061-Yash Nair E017-Shairal Neema E019-Aashita Nyati
  • 2. Agenda  Memory Hierarchy  What is Cache Memory  Working of Cache  Structure of Cache  Cache Write Policies  Levels of Cache  Cache Organization  Mapping techniques  Replacement algorithms
  • 3. Memory Hierarchy – Diagram Decreasing cost per bitIncreasing capacityIncreasing access timeDecreasing frequency of access of the memory by the processor
  • 4. What is Cache Memory?  Cache memory is used in order to achieve higher performance of CPU by allowing the CPU to access data at faster speed.  It is placed closest to the processor in the computer assembly.  It is way too costly.  It is also a type of memory but keeping in mind the cost factor it cannot be used as a primary memory.
  • 5. AN INSIGHT INTO THE WORKING OF CACHE
  • 6. Structure of the Cache memory Contains address of actual data fetched from Main Memory Contains actual data fetched From the Main Memory
  • 7. Cache write policies When we write ,should we write to cache or memory?  Write through cache – write to both cache and main memory. Cache and memory are always consistent.  Write back cache – write only to cache and set a “dirty bit”. When the block gets replaced from the cache ,write it out to memory.
  • 8. Levels of Cache Fastest Fast Less Fast Slow
  • 10. Mapping Techniques Direct mapping Associative mapping Set associative mapping
  • 11. Direct mapping Simplest technique In this , each block of main memory is mapped into only one possible cache line . i = j modulo m where , i= cache memory j= main memory m=no. of lines in the cache
  • 12.
  • 13. Address length = (s + w) bits Number of addressable units = 2^(s+w) words or bytes Block size = line size = 2w words or bytes Number of blocks in main memory = 2^(s+ w)/2^w = 2s Number of lines in cache = m = 2^r Size of tag = (s – r) bits
  • 14. ASSOCIATIVE MAPPING It overcomes the disadvantage of direct mapping. It permits each main memory block to be loaded into any line of the cache .
  • 15.
  • 16. Address length = (s + w) bits Number of addressable units = 2^(s+w) words or bytes Block size = line size = 2^w words or bytes Number of blocks in main memory = 2^(s+ w)/2^w = 2^s Number of lines in cache = undetermined Size of tag = s bits
  • 17. SET ASSOCIATIVE MAPPING  The relationship which is followed here is m= v*k i= j modulo v Where , i= cache set no. j= main memory m= no. of lines in the cache v= no. of set k= no. of lines in each set This is called k-way set associative mapping .
  • 18.
  • 19. Address length = (s + w) bits Number of addressable units = 2s+w words or bytes Block size = line size = 2^w words or bytes Number of blocks in main memory = 2^s Number of lines in set = k Number of sets = v = 2d Number of lines in cache = kv = k * 2d Size of tag = (s – d) bits
  • 20. Replacement algorithms Discard itemsAdd new ones Cache Memory Cache Full…
  • 21. Replacement algorithms  Optimizing instructions.  To manage cache information on computer.  In direct mapping. Each block only maps to one cache block .  Associative and set associative mapping.
  • 22.  Least recently used(LRU)  First in first out(FIFO)  Least frequently used(LFU)  Random Replacement algorithms
  • 23. Least Recently used  The most effective.  Keeps track of which block used when.  Discards the least recently used blocks first. USE bit 0 USE bit 1
  • 24. 2 3 4 2 1 3 7 1 2 3 4 5 6 7 2 2 2 2 2 2 7 3 3 3 1 1 1 4 4 4 3 3 EXAMPLE Page hit 1 Page fault 3 7
  • 25. First In First Out  The simplest algorithm.  Bad performance.  First entering block, is discarded first.  Replaces the block that has been in cache the longest.
  • 26. 2 3 4 2 1 3 7 1 2 3 4 5 6 7 2 2 2 2 1 1 1 3 3 3 3 3 3 4 4 4 4 7 EXAMPLE Page hit Page hit 1 7 Page fault
  • 27. Least Frequently Used  Counts how often a block is needed.  Every block has one counter of its own which is initially set to 0.  As the block is referenced, the counter is incremented.  Replaces the lowest reference frequency block.
  • 28. 2 3 4 2 1 3 7 1 2 3 4 5 6 7 2 2 2 2 2 2 2 3 3 3 3 1 1 4 4 4 4 3 EXAMPLE Page hit 1 7 Page fault I I I II I I I 3
  • 29. Random  Randomly selects a block.  Discards it to make space.  Does not keep track of access history.  This eliminates the overhead cost of tracking page references.

Editor's Notes

  1. The CPU initially looks in the Cache for the data it needs If the data is there, it will retrieve it and process it If the data is not there, then the CPU accesses the system memory and then puts a copy of the new data in the cache before processing it Next time if the CPU needs to access the same data again, it will just retrieve the data from the Cache instead of going through the whole loading process again The legit question of Why use Cache when we have RAM?
  2. Each line is assigned a USE bit .It is changed to 1 when a line is referenced.