SlideShare a Scribd company logo
1 of 13
© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Cache Management
2© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What to Expect?
Cache Fundamentals
How's of Cache
Cache Organization
Cache Pitfalls
3© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Cache Fundamentals
Mismatch between the RAM & CPU speed
Transfer rate
Latency to access the RAM
Static Vs Dynamic RAM
Systems have Dynamic RAM, which is slower
Static RAM is fast but expensive
Small static RAM between CPU & Dynamic RAM
This is known as Cache
4© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
How's of Cache
Located inside the CPU
Copies most recently accessed data from the RAM
memory to the static memory
The goal is to make CPU access the memory
cache instead of accessing directly the RAM
memory
We call it a ‘cache miss’ if the data is not present in
the cache
The circuit called cache controller loads the data
into cache
5© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
How's of Cache ...
The CPU asks for the memory / data stored in
address ‘A’
Since contents are not in cache, would be fetched
from RAM
The cache controller loads the line (typically 64
bytes) starting at address ‘A’
The circuit called prefetcher loads more data
located after this line
Branch prediction since program is not always
sequential
6© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Cache Organization
Direct Mapping
Divide the memory as per the number of cache lines
Simplest configuration, requires less meta data
Higher chances of cache misses
Fully Associative
Any memory could be loaded into any cache line
Most efficient cache organization
Extremely complex control logic
7© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Cache Organization ...
Hybrid solution called set associative
Memory cache is divided in several blocks (sets)
containing ‘n’ lines each
With this, the memory from the single block can be
put into one of the ‘n’ cache lines in the set
8© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Direct Mapping
Line 1
Line 2
...
Line 8192
128KB
128KB
128
9© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Set Associative Cache
Line 1– Line 4
Line 5 – Line 8
...
Line 2048
128KB
128KB
128
10© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Cache Pitfalls
Stale data
May severely degrade the system performance if
the program is not cache local
11© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Linux Page Cache Basics
Accelerates many accesses to files on non
volatile storage
During reads / writes to disk, Linux stores data in
unused areas of memory, which acts as cache
free -m
12© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What all have we learnt?
Cache Fundamentals
How's of Cache
Cache Organization
Cache Pitfalls
13© 2019 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Any Queries?

More Related Content

What's hot

Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
Anil Kumar Pugalia
 

What's hot (20)

Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
Understanding the BBB
Understanding the BBBUnderstanding the BBB
Understanding the BBB
 
BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
Bootloaders
BootloadersBootloaders
Bootloaders
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time Systems
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Linux DMA Engine
Linux DMA EngineLinux DMA Engine
Linux DMA Engine
 
Synchronization
SynchronizationSynchronization
Synchronization
 
Block Drivers
Block DriversBlock Drivers
Block Drivers
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 

Similar to Cache Management

RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
Redis Labs
 
Efektywna Witualizacja Citrix na macierzach dyskowych NetApp
Efektywna Witualizacja Citrix na macierzach dyskowych NetAppEfektywna Witualizacja Citrix na macierzach dyskowych NetApp
Efektywna Witualizacja Citrix na macierzach dyskowych NetApp
Peter Ocasek
 
Distributing Data The Aerospike Way
Distributing Data The Aerospike WayDistributing Data The Aerospike Way
Distributing Data The Aerospike Way
Aerospike, Inc.
 

Similar to Cache Management (20)

ch9.pptx
ch9.pptxch9.pptx
ch9.pptx
 
ch9.pptx
ch9.pptxch9.pptx
ch9.pptx
 
Chapter 9 Operating Systems silberschatz
Chapter 9 Operating Systems silberschatzChapter 9 Operating Systems silberschatz
Chapter 9 Operating Systems silberschatz
 
IRJET- A Futuristic Cache Replacement using Hybrid Regression
IRJET-  	  A Futuristic Cache Replacement using Hybrid RegressionIRJET-  	  A Futuristic Cache Replacement using Hybrid Regression
IRJET- A Futuristic Cache Replacement using Hybrid Regression
 
New Business Applications Powered by In-Memory Technology @MIT Forum for Supp...
New Business Applications Powered by In-Memory Technology @MIT Forum for Supp...New Business Applications Powered by In-Memory Technology @MIT Forum for Supp...
New Business Applications Powered by In-Memory Technology @MIT Forum for Supp...
 
RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
RedisConf18 - Auto-Scaling Redis Caches - Observability, Efficiency & Perform...
 
ch8-1 (final Memory).pptx
ch8-1 (final Memory).pptxch8-1 (final Memory).pptx
ch8-1 (final Memory).pptx
 
Share point 2013’s distributed cache service 6.0 (1)
Share point 2013’s distributed cache service 6.0 (1)Share point 2013’s distributed cache service 6.0 (1)
Share point 2013’s distributed cache service 6.0 (1)
 
Cache memory presentation
Cache memory presentationCache memory presentation
Cache memory presentation
 
S106195 cos-use cases-istanbul-v1902a
S106195 cos-use cases-istanbul-v1902aS106195 cos-use cases-istanbul-v1902a
S106195 cos-use cases-istanbul-v1902a
 
S104875 nightmares-dreams-spectrum-control-jburg-v1809h
S104875 nightmares-dreams-spectrum-control-jburg-v1809hS104875 nightmares-dreams-spectrum-control-jburg-v1809h
S104875 nightmares-dreams-spectrum-control-jburg-v1809h
 
AIX Performance Tuning Session at STU2017
AIX Performance Tuning Session at STU2017AIX Performance Tuning Session at STU2017
AIX Performance Tuning Session at STU2017
 
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018
 
Cloud Computing 2023 - Lecture 07.pptx
Cloud Computing 2023 - Lecture 07.pptxCloud Computing 2023 - Lecture 07.pptx
Cloud Computing 2023 - Lecture 07.pptx
 
NVMe and Flash – Make Your Storage Great Again!
NVMe and Flash – Make Your Storage Great Again!NVMe and Flash – Make Your Storage Great Again!
NVMe and Flash – Make Your Storage Great Again!
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Efektywna Witualizacja Citrix na macierzach dyskowych NetApp
Efektywna Witualizacja Citrix na macierzach dyskowych NetAppEfektywna Witualizacja Citrix na macierzach dyskowych NetApp
Efektywna Witualizacja Citrix na macierzach dyskowych NetApp
 
Help, my Kafka is broken! (Emma Humber, IBM) Kafka Summit SF 2019
Help, my Kafka is broken! (Emma Humber, IBM) Kafka Summit SF 2019Help, my Kafka is broken! (Emma Humber, IBM) Kafka Summit SF 2019
Help, my Kafka is broken! (Emma Humber, IBM) Kafka Summit SF 2019
 
From the trenches: scaling a large log management deployment
From the trenches: scaling a large log management deploymentFrom the trenches: scaling a large log management deployment
From the trenches: scaling a large log management deployment
 
Distributing Data The Aerospike Way
Distributing Data The Aerospike WayDistributing Data The Aerospike Way
Distributing Data The Aerospike Way
 

More from SysPlay eLearning Academy for You (12)

Linux Internals Part - 3
Linux Internals Part - 3Linux Internals Part - 3
Linux Internals Part - 3
 
Linux Internals Part - 2
Linux Internals Part - 2Linux Internals Part - 2
Linux Internals Part - 2
 
Linux Internals Part - 1
Linux Internals Part - 1Linux Internals Part - 1
Linux Internals Part - 1
 
Kernel Timing Management
Kernel Timing ManagementKernel Timing Management
Kernel Timing Management
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
 
Introduction to BeagleBone Black
Introduction to BeagleBone BlackIntroduction to BeagleBone Black
Introduction to BeagleBone Black
 
Introduction to BeagleBoard-xM
Introduction to BeagleBoard-xMIntroduction to BeagleBoard-xM
Introduction to BeagleBoard-xM
 
Platform Drivers
Platform DriversPlatform Drivers
Platform Drivers
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Linux System
Linux SystemLinux System
Linux System
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Cache Management

  • 1. © 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Cache Management
  • 2. 2© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? Cache Fundamentals How's of Cache Cache Organization Cache Pitfalls
  • 3. 3© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Cache Fundamentals Mismatch between the RAM & CPU speed Transfer rate Latency to access the RAM Static Vs Dynamic RAM Systems have Dynamic RAM, which is slower Static RAM is fast but expensive Small static RAM between CPU & Dynamic RAM This is known as Cache
  • 4. 4© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. How's of Cache Located inside the CPU Copies most recently accessed data from the RAM memory to the static memory The goal is to make CPU access the memory cache instead of accessing directly the RAM memory We call it a ‘cache miss’ if the data is not present in the cache The circuit called cache controller loads the data into cache
  • 5. 5© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. How's of Cache ... The CPU asks for the memory / data stored in address ‘A’ Since contents are not in cache, would be fetched from RAM The cache controller loads the line (typically 64 bytes) starting at address ‘A’ The circuit called prefetcher loads more data located after this line Branch prediction since program is not always sequential
  • 6. 6© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Cache Organization Direct Mapping Divide the memory as per the number of cache lines Simplest configuration, requires less meta data Higher chances of cache misses Fully Associative Any memory could be loaded into any cache line Most efficient cache organization Extremely complex control logic
  • 7. 7© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Cache Organization ... Hybrid solution called set associative Memory cache is divided in several blocks (sets) containing ‘n’ lines each With this, the memory from the single block can be put into one of the ‘n’ cache lines in the set
  • 8. 8© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Direct Mapping Line 1 Line 2 ... Line 8192 128KB 128KB 128
  • 9. 9© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Set Associative Cache Line 1– Line 4 Line 5 – Line 8 ... Line 2048 128KB 128KB 128
  • 10. 10© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Cache Pitfalls Stale data May severely degrade the system performance if the program is not cache local
  • 11. 11© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Linux Page Cache Basics Accelerates many accesses to files on non volatile storage During reads / writes to disk, Linux stores data in unused areas of memory, which acts as cache free -m
  • 12. 12© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What all have we learnt? Cache Fundamentals How's of Cache Cache Organization Cache Pitfalls
  • 13. 13© 2019 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?