2020年12月21日星期一

What data will be cached?

The description of cache in the book is always very general. I am a student in the field of architecture. I want to understand the behavior of the cache in more detail.

In the c/c++ language code, what data will be loaded from the memory to the cache? Will it be loaded into the cache when it is frequently used? For example, when I write a for loop in C language, I often use variables i, j, and k. Will these also be loaded into the cache? C language local variables are generally placed in the stack area, global variables will be placed in the data area? Will these be loaded into the cache first when they are used?

The pointer variable p stores the address of the data. If I use the pointer *p to access a variable. Will p be loaded into the cache first, and then *p will be loaded into the cache?

https://stackoverflow.com/questions/65402150/what-data-will-be-cached December 22, 2020 at 09:29AM

没有评论:

发表评论