关于tlb表和data cache的关系
在阅读modern operating system中。关于tlb表的部分涉及到了一个FastMATH的实例。博主当时有一个疑惑。既然TLB表是一种cache。那么为什么还需要一个data cache呢?在google了之后得到了答案。
tlb是一种关于page table的cache。是一种virtual address to physical address lookup。data cache是一种关于main memory的cache。
Therefore, the data cache acts as a dedicated cache for memory reads. The data cache has some cache entries, where each cache entry contains a physical address and the value of memory at that address.
这就是为什么在fastmath中tlb表作为cache已经存在了,但是还是需要一个data cache。
这两个cache的工作机理如下:
They are both caches, but they serve a different purpose. The processor uses both for each memory operation: it first uses the TLB to convert from virtual address to physical address, then it checks the data cache to speed up the process of reading the value stored in memory at that address.