Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Types of Cache Misses
Next article icon

Types of Cache Misses

Last Updated : 24 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A cache miss occurs when the data that the processor needs is not found in the cache memory. Since cache memory is much faster than main memory, a miss causes the processor to fetch the required data from slower main memory, resulting in a delay. Cache misses can significantly impact system performance, especially in programs that frequently access data that doesn't fit into the cache.

When a cache miss happens, the system must retrieve the data from a lower-level cache or main memory, which introduces latency and reduces the overall efficiency of the CPU. To minimize these misses, cache management strategies and algorithms such as cache replacement policies and prefetching are employed to predict and reduce cache misses, improving processing speed.

Types of Cache Misses

Cache misses occur when the processor attempts to access data that is not present in the cache. When this happens, the data needs to be fetched from the slower main memory, which results in increased latency. There are four primary types of cache misses: compulsory misses, capacity misses, conflict misses, and coherence misses. Understanding these misses is crucial for optimizing memory access performance.

1. Compulsory Misses

  • Description: Compulsory misses occur when a memory block is accessed for the first time, meaning it’s not yet in the cache. Since the data has never been loaded before, the cache will miss the access and need to fetch the data from the main memory.
  • Other Names: Cold-start misses, compulsory line fills.
  • Impact: These misses are inevitable and cannot be avoided, especially for new data accesses. However, they can be minimized by increasing cache efficiency or using better prefetching techniques.

2. Capacity Misses

  • Description: Capacity misses happen when the cache does not have enough space to store all the data needed by the processor. When the cache becomes full, older or unused data may be evicted, resulting in misses when the data is accessed again.
  • Impact: These misses are more likely to occur when dealing with large datasets or applications that require more data than the cache can hold.

3. Conflict Misses

  • Description: Conflict misses occur in direct-mapped and set-associative caches due to the limited number of locations available for storing data. If multiple memory blocks map to the same cache location, one block will evict another, causing a miss when the evicted block is accessed again.
  • Impact: Conflict misses are more common in direct-mapped caches, where each memory block is mapped to a specific location.

4. Coherence Misses

  • Description: Coherence misses, also known as invalidation misses, occur in systems with multiple processors or cores. These misses arise when a processor's cache holds stale data that has been modified by another processor or an external device (e.g., I/O devices).
  • Cause: These misses typically occur when data is invalidated or modified in one cache, and the change must be reflected in other caches.
  • Impact: Coherence misses can introduce delays due to the need for data synchronization across processors or devices.

Read about Cache in Computer Organization

Cache Line Prefetching and Cache Misses

Cache line prefetching is a technique used by processors to improve memory access performance. It works by fetching multiple contiguous cache lines from memory into the processor's cache ahead of time, anticipating that these lines will be needed soon.

Cache line prefetching takes advantage of spatial locality, which refers to the tendency of a program to access nearby memory locations in succession. By preloading contiguous cache lines, typically 64 bytes or more, the processor reduces the latency for subsequent memory accesses.

There are several methods for implementing cache line prefetching:

  • Hardware Prefetching: Modern processors include hardware units that automatically monitor memory access patterns. These units predict which cache lines will be needed and fetch them in advance, improving performance without requiring software intervention.
  • Software Prefetching: Programmers can manually insert prefetch instructions into the code to request the processor to load specific memory locations into the cache before they are accessed. This requires careful analysis of memory access patterns and an understanding of the hardware.
  • Compiler-Assisted Prefetching: Some compilers can analyze the code and automatically insert prefetch instructions based on detected memory access patterns. This reduces the burden on the programmer by handling the prefetching optimization automatically.

Cache line prefetching plays a crucial role in minimizing cache misses. By proactively fetching multiple contiguous cache lines into the cache before they are accessed, it can help reduce the following types of cache misses:

  1. Compulsory Misses: Cache line prefetching can help reduce compulsory misses by preloading data that is likely to be accessed soon, even before the first access. This reduces the latency for first-time accesses by ensuring the data is already in the cache when needed.
  2. Capacity Misses: By loading multiple contiguous cache lines in advance, cache line prefetching can make better use of the available cache space, potentially reducing the number of capacity misses. However, this depends on the predictability of the memory access patterns and the available cache size.
  3. Conflict Misses: Cache line prefetching may not directly eliminate conflict misses in direct-mapped or set-associative caches, but it can reduce their occurrence by ensuring that the data is already in the cache before it’s needed, thus reducing the likelihood of eviction due to mapping conflicts.
  4. Coherence Misses: Cache line prefetching doesn’t directly impact coherence misses since these are related to maintaining data consistency across processors or devices. However, effective prefetching can reduce the frequency of cache invalidations by ensuring that frequently accessed data is already available in the cache.

Next Article
Types of Cache Misses

R

rajkumarupadhyay515
Improve
Article Tags :
  • Computer Organization and Architecture

Similar Reads

    Types of Memory Interleaving
    Memory Interleaving is an abstraction technique which divides memory into a number of modules such that successive words in the address space are placed in the different module. Suppose a 64 MB memory made up of the 4 MB chips as shown in the below: We organize the memory into 4 MB banks, each havin
    2 min read
    Multilevel Cache Organisation
    Cache is a type of random access memory (RAM) used by the CPU to reduce the average time required to access data from memory. Multilevel caches are one of the techniques used to improve cache performance by reducing the miss penalty. The miss penalty refers to the additional time needed to retrieve
    6 min read
    Memory Access Methods
    These are 4 types of memory access methods: 1. Sequential Access:- In this method, the memory is accessed in a specific linear sequential manner, like accessing in a single Linked List. The access time depends on the location of the data. Applications of this sequential memory access are magnetic ta
    2 min read
    Basic Cache Optimization Techniques
    Generally, in any device, memories that are large(in terms of capacity), fast and affordable are preferred. But all three qualities can't be achieved at the same time. The cost of the memory depends on its speed and capacity. With the Hierarchical Memory System, all three can be achieved simultaneou
    5 min read
    Terminologies in Cache Memory Organization
    Cache memory is a small, high-speed storage used to temporarily hold frequently accessed data or instructions. It helps speed up processing by providing faster access to data compared to main memory (RAM). Cache memory is typically smaller but much faster than main memory, and it holds a portion of
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences