SlideShare a Scribd company logo
CACHE
    MEMORY




                         07/07/12
     How caching works

1
What is a Cache?
The cache is a very high speed, expensive piece of memory, which is used to




                                                                                   07/07/12
speed up the memory retrieval process. Due to itā€™s higher cost, the CPU comes
with a relatively small amount of cache compared with the main memory.
Without cache memory, every time the CPU requests for data, it would send the
request to the main memory which would then be sent back across the system
bus to the CPU. This is a slow process. The idea of introducing cache is that this
extremely fast memory would store data that is frequently accessed and if
possible, the data that is around it. This is to achieve the quickest possible
response time to the CPU.




                                                                               2
Role of Cache in Computers
In early PCs, the various components had one thing in common: they were all really
slow. The processor was running at 8 MHz or less, and taking many clock cycles to get




                                                                                            07/07/12
anything done. In fact, on some machines the memory was faster than the processor.
With the advancement of technology, the speed of every component has increased
drastically. Now processors run much faster than everything else in the computer. This
means that one of the key goals in modern system design is to ensure that to whatever
extent possible, the processor is not slowed down by the storage devices it works with.
Slowdowns mean wasted processor cycles, where the CPU can't do anything because it
is sitting and waiting for information it needs.
The best way to keep the processor from having to wait is to make everything that it
uses as fast as it is. But that would be very expensive.
There is a good compromise to this however. Instead of trying to make the whole 64
MB out of this faster, expensive memory, you make a smaller piece, say 256 KB. Then
you find a smart algorithm (process) that allows you to use this 256 KB in such a way
that you get almost as much benefit from it as you would if the whole 64 MB was
made from the faster memory. How do you do this? The answer is by using this small
cache of 256 KB to hold the information most recently used by the processor.
Computer science shows that in general, a processor is much more likely to need again
                                                                                        3
information it has recently used, compared to a random piece of information in
memory. This is the principle behind caching
Types of Cache Memory
ā€¢ Memory Cache: A memory cache, sometimes called a cache store or RAM cache, is a




                                                                                         07/07/12
portion of memory made of high-speed static RAM (SRAM) instead of the slower and
cheaper dynamic RAM (DRAM) used for main memory. Memory caching is effective
because most programs access the same data or instructions over and over. By keeping as
much of this information as possible in SRAM, the computer avoids accessing the slower
DRAM.


ā€¢ Disk Cache: Disk caching works under the same principle as memory caching, but
instead of using high-speed SRAM, a disk cache uses conventional main memory. The
most recently accessed data from the disk (as well as adjacent sectors) is stored in a
memory buffer. When a program needs to access data from the disk, it first checks the
disk cache to see if the data is there. Disk caching can dramatically improve the
performance of applications, because accessing a byte of data in RAM can be thousands
of times faster than accessing a byte on a hard disk.

                                                                                     4
Levels of Cache: Cache memory is categorized in levels based on itā€™s closeness
and accessibility to the microprocessor. There are three levels of a cache.
ļ¶Level 1(L1) Cache: This cache is inbuilt in the processor and is made of SRAM(Static RAM)
Each time the processor requests information from memory, the cache controller on the chip uses




                                                                                                          07/07/12
special circuitry to first check if the memory data is already in the cache. If it is present, then the
system is spared from time consuming access to the main memory. In a typical CPU, primary cache
ranges in size from 8 to 64 KB, with larger amounts on the newer processors. This type of Cache
Memory is very fast because it runs at the speed of the processor since it is integrated into it.
ļ¶Level 2(L2) Cache: The L2 cache is larger but slower in speed than L1 cache. It is used to see
recent accesses that is not picked by L1 cache and is usually 64 to 2 MB in size. A L2 cache is also
found on the CPU. If L1 and L2 cache are used together, then the missing information that is not
present in L1 cache can be retrieved quickly from the L2 cache. Like L1 caches, L2 caches are
composed of SRAM but they are much larger. L2 is usually a separate static RAM (SRAM) chip and it
is placed between the CPU & DRAM(Main Memory)

ļ¶Level 3(L3) Cache: L3 Cache memory is an enhanced form of memory present on the
motherboard of the computer. It is an extra cache built into the motherboard between the processor and
main memory to speed up the processing operations. It reduces the time gap between request and
retrieving of the data and instructions much more quickly than a main memory. L3 cache are being used
with processors nowadays, having more than 3 MB of storage in it.
                                                                                                      5
Diagram showing different types of cache and their
position in the computer system




                                                         07/07/12
                                                     6
Principle behind Cache Memory
Cache is a really amazing technology. A 512 KB level 2 cache, caching 64 MB of
system memory, can supply the information that the processor requests 90-95% of the
time. The level 2 cache is less than 1% of the size of the memory it is caching, but it is




                                                                                             07/07/12
able to register a hit on over 90% of requests. That's pretty efficient, and is the reason
why caching is so important.

The reason that this happens is due to a computer science principle called locality of
reference. It states basically that even within very large programs with several
megabytes of instructions, only small portions of this code generally get used at once.
Programs tend to spend large periods of time working in one small area of the code,
often performing the same work many times over and over with slightly different data,
and then move to another area. This occurs because of "loops", which are what
programs use to do work many times in rapid succession.




                                                                                         7
Locality of Reference
Let's take a look at the following pseudo-code to see how locality of reference works
Output to screen Ā« Enter a number between 1 and 100 Ā»
Read input from user




                                                                                                                   07/07/12
Put value from user in variable X
Put value 100 in variable Y
Put value 1 in variable Z
Loop Y number of time Divide Z by X
 If the remainder of the division = 0
then output Ā« Z is a multiple of X Ā»
Add 1 to Z
Return to loop
End
This small program asks the user to enter a number between 1 and 100. It reads the value entered by the user.
Then, the program divides every number between 1 and 100 by the number entered by the user. It checks if
the remainder is 0. If so, the program outputs "Z is a multiple of X", for every number between 1 and 100.
Then the program ends.
Now it is easy to understand that in the 11 lines of this program, the loop part (lines 7 to 9) are executed 100
times. All of the other lines are executed only once. Lines 7 to 9 will run significantly faster because of
caching. This program is very small and can easily fit entirely in the smallest of L1 caches, but let's say this
program is huge. The result remains the same. When you program, a lot of action takes place inside loops.
This 95%-to-5% ratio (approximately) is what we call the locality of reference, and it's why a cache works
so efficiently. This is also why such a small cache can efficiently cache such a large memory system. You
can see why it's not worth it to construct a computer with the fastest memory everywhere. We can deliver 95 8
percent of this effectiveness for a fraction of the cost
Importance of Cache

Cache is responsible for a great deal of the system performance




                                                                     07/07/12
improvement of today's PCs. The cache is a buffer of sorts between
the very fast processor and the relatively slow memory that serves
it. The presence of the cache allows the processor to do its work
while waiting for memory far less often than it otherwise would.
Without cache the computer will be very slow and all our works get
delay. So cache is a very important part of our computer system.




                                                                 9
Resources:
ļƒ¼www.pcguide.com




                          07/07/12
ļƒ¼www.howstuffworks.com
ļƒ¼www.webopedia.com



             Thank You
                         10

More Related Content

What's hot

Cache memory
Cache memory Cache memory
Cache memory
Zalal Udeen
Ā 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
Ā 
Random Access Memory ppt
Random Access Memory pptRandom Access Memory ppt
Random Access Memory ppt
OECLIB Odisha Electronics Control Library
Ā 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
Ā 
Cache Memory
Cache MemoryCache Memory
Cache Memory
Subid Biswas
Ā 
Memory system
Memory systemMemory system
Memory system
gourav kottawar
Ā 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
Raj Mohan
Ā 
Cache memory principles
Cache memory principlesCache memory principles
Cache memory principles
bit allahabad
Ā 
Primary memory (main memory)
Primary memory (main memory)Primary memory (main memory)
Primary memory (main memory)
shah baadshah
Ā 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
Ā 
Computer architecture memory system
Computer architecture memory systemComputer architecture memory system
Computer architecture memory system
Mazin Alwaaly
Ā 
Memory management
Memory managementMemory management
Memory management
cpjcollege
Ā 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architecture
Faisal Hussain
Ā 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
Anurag Verma
Ā 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentation
hamza haseeb
Ā 
Cache memory
Cache memoryCache memory
Cache memory
George Thomas
Ā 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
rprajat007
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Faiq Ali Sayed
Ā 
Computer MEMORY
Computer MEMORYComputer MEMORY
Computer MEMORY
Swarnima Tiwari
Ā 

What's hot (20)

Cache memory
Cache memory Cache memory
Cache memory
Ā 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Ā 
Random Access Memory ppt
Random Access Memory pptRandom Access Memory ppt
Random Access Memory ppt
Ā 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Ā 
Cache Memory
Cache MemoryCache Memory
Cache Memory
Ā 
Memory system
Memory systemMemory system
Memory system
Ā 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
Ā 
Cache memory principles
Cache memory principlesCache memory principles
Cache memory principles
Ā 
Primary memory (main memory)
Primary memory (main memory)Primary memory (main memory)
Primary memory (main memory)
Ā 
Demand paging
Demand pagingDemand paging
Demand paging
Ā 
Computer architecture memory system
Computer architecture memory systemComputer architecture memory system
Computer architecture memory system
Ā 
Memory management
Memory managementMemory management
Memory management
Ā 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
Ā 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architecture
Ā 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
Ā 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentation
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Ā 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Ā 
Computer MEMORY
Computer MEMORYComputer MEMORY
Computer MEMORY
Ā 

Similar to Cache memory presentation

Cache memory and cache
Cache memory and cacheCache memory and cache
Cache memory and cache
VISHAL DONGA
Ā 
Cache Memory- JMD.pptx
Cache Memory- JMD.pptxCache Memory- JMD.pptx
Cache Memory- JMD.pptx
JulianaMeiDuldulao
Ā 
Linux%20 memory%20management
Linux%20 memory%20managementLinux%20 memory%20management
Linux%20 memory%20management
Koteswaran Chandra Mohan
Ā 
Virtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryVirtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryAshik Iqbal
Ā 
Cache memory ...
Cache memory ...Cache memory ...
Cache memory ...
Pratik Farkya
Ā 
Massively Parallel Architectures
Massively Parallel ArchitecturesMassively Parallel Architectures
Massively Parallel Architectures
Jason Hearne-McGuiness
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Abir Rahman
Ā 
memorytechnologyandoptimization-140416131506-phpapp02.pptx
memorytechnologyandoptimization-140416131506-phpapp02.pptxmemorytechnologyandoptimization-140416131506-phpapp02.pptx
memorytechnologyandoptimization-140416131506-phpapp02.pptx
shahdivyanshu1002
Ā 
Unit I Memory technology and optimization
Unit I Memory technology and optimizationUnit I Memory technology and optimization
Unit I Memory technology and optimization
K Gowsic Gowsic
Ā 
Memory technology and optimization in Advance Computer Architechture
Memory technology and optimization in Advance Computer ArchitechtureMemory technology and optimization in Advance Computer Architechture
Memory technology and optimization in Advance Computer ArchitechtureShweta Ghate
Ā 
Cache Memory.pptx
Cache Memory.pptxCache Memory.pptx
Cache Memory.pptx
ssusere16bd9
Ā 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memory
PrakharBansal29
Ā 
Understanding And Managing Memory
Understanding And Managing MemoryUnderstanding And Managing Memory
Understanding And Managing Memoryisma ishak
Ā 
Low level java programming
Low level java programmingLow level java programming
Low level java programming
Peter Lawrey
Ā 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack Optimization
Dave Ross
Ā 
Ram and types of ram.Cache
Ram and types of ram.CacheRam and types of ram.Cache
Ram and types of ram.Cache
hamza mukhtiar
Ā 
Cache memory
Cache memory Cache memory
Cache memory
IndrajaMeghavathula
Ā 
os
osos
2. the memory systems (module2)
2. the memory systems (module2)2. the memory systems (module2)
2. the memory systems (module2)
Ajit Saraf
Ā 

Similar to Cache memory presentation (20)

Cache memory and cache
Cache memory and cacheCache memory and cache
Cache memory and cache
Ā 
Cache Memory- JMD.pptx
Cache Memory- JMD.pptxCache Memory- JMD.pptx
Cache Memory- JMD.pptx
Ā 
Linux%20 memory%20management
Linux%20 memory%20managementLinux%20 memory%20management
Linux%20 memory%20management
Ā 
Virtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryVirtual Memory vs Cache Memory
Virtual Memory vs Cache Memory
Ā 
Cache memory ...
Cache memory ...Cache memory ...
Cache memory ...
Ā 
Massively Parallel Architectures
Massively Parallel ArchitecturesMassively Parallel Architectures
Massively Parallel Architectures
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Ā 
Cache memory
Cache memoryCache memory
Cache memory
Ā 
memorytechnologyandoptimization-140416131506-phpapp02.pptx
memorytechnologyandoptimization-140416131506-phpapp02.pptxmemorytechnologyandoptimization-140416131506-phpapp02.pptx
memorytechnologyandoptimization-140416131506-phpapp02.pptx
Ā 
Unit I Memory technology and optimization
Unit I Memory technology and optimizationUnit I Memory technology and optimization
Unit I Memory technology and optimization
Ā 
Memory technology and optimization in Advance Computer Architechture
Memory technology and optimization in Advance Computer ArchitechtureMemory technology and optimization in Advance Computer Architechture
Memory technology and optimization in Advance Computer Architechture
Ā 
Cache Memory.pptx
Cache Memory.pptxCache Memory.pptx
Cache Memory.pptx
Ā 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memory
Ā 
Understanding And Managing Memory
Understanding And Managing MemoryUnderstanding And Managing Memory
Understanding And Managing Memory
Ā 
Low level java programming
Low level java programmingLow level java programming
Low level java programming
Ā 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack Optimization
Ā 
Ram and types of ram.Cache
Ram and types of ram.CacheRam and types of ram.Cache
Ram and types of ram.Cache
Ā 
Cache memory
Cache memory Cache memory
Cache memory
Ā 
os
osos
os
Ā 
2. the memory systems (module2)
2. the memory systems (module2)2. the memory systems (module2)
2. the memory systems (module2)
Ā 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
Ā 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
Ā 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
Ā 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
Ā 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
Ā 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
Ā 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
Ā 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
Ā 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
UiPathCommunity
Ā 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
Ā 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
Ā 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
Ā 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
Ā 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
Ā 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
Ā 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
Ā 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
Ā 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
Ā 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Ā 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
Ā 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Ā 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
Ā 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Ā 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Ā 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Ā 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Ā 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Ā 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Ā 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Ā 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Ā 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
Ā 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Ā 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Ā 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ā 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
Ā 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Ā 

Cache memory presentation

  • 1. CACHE MEMORY 07/07/12 How caching works 1
  • 2. What is a Cache? The cache is a very high speed, expensive piece of memory, which is used to 07/07/12 speed up the memory retrieval process. Due to itā€™s higher cost, the CPU comes with a relatively small amount of cache compared with the main memory. Without cache memory, every time the CPU requests for data, it would send the request to the main memory which would then be sent back across the system bus to the CPU. This is a slow process. The idea of introducing cache is that this extremely fast memory would store data that is frequently accessed and if possible, the data that is around it. This is to achieve the quickest possible response time to the CPU. 2
  • 3. Role of Cache in Computers In early PCs, the various components had one thing in common: they were all really slow. The processor was running at 8 MHz or less, and taking many clock cycles to get 07/07/12 anything done. In fact, on some machines the memory was faster than the processor. With the advancement of technology, the speed of every component has increased drastically. Now processors run much faster than everything else in the computer. This means that one of the key goals in modern system design is to ensure that to whatever extent possible, the processor is not slowed down by the storage devices it works with. Slowdowns mean wasted processor cycles, where the CPU can't do anything because it is sitting and waiting for information it needs. The best way to keep the processor from having to wait is to make everything that it uses as fast as it is. But that would be very expensive. There is a good compromise to this however. Instead of trying to make the whole 64 MB out of this faster, expensive memory, you make a smaller piece, say 256 KB. Then you find a smart algorithm (process) that allows you to use this 256 KB in such a way that you get almost as much benefit from it as you would if the whole 64 MB was made from the faster memory. How do you do this? The answer is by using this small cache of 256 KB to hold the information most recently used by the processor. Computer science shows that in general, a processor is much more likely to need again 3 information it has recently used, compared to a random piece of information in memory. This is the principle behind caching
  • 4. Types of Cache Memory ā€¢ Memory Cache: A memory cache, sometimes called a cache store or RAM cache, is a 07/07/12 portion of memory made of high-speed static RAM (SRAM) instead of the slower and cheaper dynamic RAM (DRAM) used for main memory. Memory caching is effective because most programs access the same data or instructions over and over. By keeping as much of this information as possible in SRAM, the computer avoids accessing the slower DRAM. ā€¢ Disk Cache: Disk caching works under the same principle as memory caching, but instead of using high-speed SRAM, a disk cache uses conventional main memory. The most recently accessed data from the disk (as well as adjacent sectors) is stored in a memory buffer. When a program needs to access data from the disk, it first checks the disk cache to see if the data is there. Disk caching can dramatically improve the performance of applications, because accessing a byte of data in RAM can be thousands of times faster than accessing a byte on a hard disk. 4
  • 5. Levels of Cache: Cache memory is categorized in levels based on itā€™s closeness and accessibility to the microprocessor. There are three levels of a cache. ļ¶Level 1(L1) Cache: This cache is inbuilt in the processor and is made of SRAM(Static RAM) Each time the processor requests information from memory, the cache controller on the chip uses 07/07/12 special circuitry to first check if the memory data is already in the cache. If it is present, then the system is spared from time consuming access to the main memory. In a typical CPU, primary cache ranges in size from 8 to 64 KB, with larger amounts on the newer processors. This type of Cache Memory is very fast because it runs at the speed of the processor since it is integrated into it. ļ¶Level 2(L2) Cache: The L2 cache is larger but slower in speed than L1 cache. It is used to see recent accesses that is not picked by L1 cache and is usually 64 to 2 MB in size. A L2 cache is also found on the CPU. If L1 and L2 cache are used together, then the missing information that is not present in L1 cache can be retrieved quickly from the L2 cache. Like L1 caches, L2 caches are composed of SRAM but they are much larger. L2 is usually a separate static RAM (SRAM) chip and it is placed between the CPU & DRAM(Main Memory) ļ¶Level 3(L3) Cache: L3 Cache memory is an enhanced form of memory present on the motherboard of the computer. It is an extra cache built into the motherboard between the processor and main memory to speed up the processing operations. It reduces the time gap between request and retrieving of the data and instructions much more quickly than a main memory. L3 cache are being used with processors nowadays, having more than 3 MB of storage in it. 5
  • 6. Diagram showing different types of cache and their position in the computer system 07/07/12 6
  • 7. Principle behind Cache Memory Cache is a really amazing technology. A 512 KB level 2 cache, caching 64 MB of system memory, can supply the information that the processor requests 90-95% of the time. The level 2 cache is less than 1% of the size of the memory it is caching, but it is 07/07/12 able to register a hit on over 90% of requests. That's pretty efficient, and is the reason why caching is so important. The reason that this happens is due to a computer science principle called locality of reference. It states basically that even within very large programs with several megabytes of instructions, only small portions of this code generally get used at once. Programs tend to spend large periods of time working in one small area of the code, often performing the same work many times over and over with slightly different data, and then move to another area. This occurs because of "loops", which are what programs use to do work many times in rapid succession. 7
  • 8. Locality of Reference Let's take a look at the following pseudo-code to see how locality of reference works Output to screen Ā« Enter a number between 1 and 100 Ā» Read input from user 07/07/12 Put value from user in variable X Put value 100 in variable Y Put value 1 in variable Z Loop Y number of time Divide Z by X If the remainder of the division = 0 then output Ā« Z is a multiple of X Ā» Add 1 to Z Return to loop End This small program asks the user to enter a number between 1 and 100. It reads the value entered by the user. Then, the program divides every number between 1 and 100 by the number entered by the user. It checks if the remainder is 0. If so, the program outputs "Z is a multiple of X", for every number between 1 and 100. Then the program ends. Now it is easy to understand that in the 11 lines of this program, the loop part (lines 7 to 9) are executed 100 times. All of the other lines are executed only once. Lines 7 to 9 will run significantly faster because of caching. This program is very small and can easily fit entirely in the smallest of L1 caches, but let's say this program is huge. The result remains the same. When you program, a lot of action takes place inside loops. This 95%-to-5% ratio (approximately) is what we call the locality of reference, and it's why a cache works so efficiently. This is also why such a small cache can efficiently cache such a large memory system. You can see why it's not worth it to construct a computer with the fastest memory everywhere. We can deliver 95 8 percent of this effectiveness for a fraction of the cost
  • 9. Importance of Cache Cache is responsible for a great deal of the system performance 07/07/12 improvement of today's PCs. The cache is a buffer of sorts between the very fast processor and the relatively slow memory that serves it. The presence of the cache allows the processor to do its work while waiting for memory far less often than it otherwise would. Without cache the computer will be very slow and all our works get delay. So cache is a very important part of our computer system. 9
  • 10. Resources: ļƒ¼www.pcguide.com 07/07/12 ļƒ¼www.howstuffworks.com ļƒ¼www.webopedia.com Thank You 10