Top "Cpu-cache" questions

A CPU-cache is a hardware structure used by the CPU to reduce the average access memory time.

Write-back vs Write-Through caching?

My understanding is that the main difference between the two methods is that in "write-through" method data is written to …

caching cpu-architecture cpu-cache
What is a "cache-friendly" code?

What is the difference between "cache unfriendly code" and the "cache friendly" code? How can I make sure I write …

c++ performance caching memory cpu-cache
Line size of L1 and L2 caches

From a previous question on this forum, I learned that in most of the memory systems, L1 cache is a …

caching memory-management cpu-architecture cpu-cache
Approximate cost to access various caches and main memory?

Can anyone give me the approximate time (in nanoseconds) to access L1, L2 and L3 caches, as well as main …

memory latency cpu-cache low-latency
What is a cache hit and a cache miss? Why would context-switching cause cache miss?

From the 11th Chapter(Performance and Scalability) and the section named Context Switching of the JCIP book: When a new …

concurrency language-agnostic cpu cpu-architecture cpu-cache
How does one write code that best utilizes the CPU cache to improve performance?

This could sound like a subjective question, but what I am looking for are specific instances, which you could have …

caching performance cpu-cache
Temporal vs Spatial Locality with arrays

I am a little confused on the meanings of spatial and temporal locality. I'm hoping by looking at it with …

arrays caching cpu-architecture cpu-cache
What's the difference between conflict miss and capacity miss

Capacity miss occurs because blocks are being discarded from cache because cache cannot contain all blocks needed for program execution (…

caching cpu cpu-cache
Why does the order of the loops affect performance when iterating over a 2D array?

Below are two programs that are almost identical except that I switched the i and j variables around. They both …

c performance for-loop optimization cpu-cache
Difference Between a Direct-Mapped Cache and Fully Associative Cache

I can't quite understand the main differences between the two caches and I was wondering if someone could help me …

memory memory-management cpu-cache