且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

"数据位"容量VS"开销比特"尺寸?

更新时间:2022-06-15 19:54:18

我不知道你已经给了我们足够的上下文这个问题,但在这里不用。

I'm not sure you've given us enough context for this question, but here goes.

缓存必须存储不仅实际的缓存数据,也 - 对每一块的数据 - 的指数,它指的是。所以,当你查找记录N,缓存不仅要持有创纪录的N值,而且N - 这样你实际上可以查找数据。这就是看它一个pretty简单的方式。高速缓存可能有其他的元数据来表示有效性,并最后访问时间等。

Caches have to store not only the actual cached data, but also - for every piece of data - the "index" that it refers to. So when you lookup record N, the cache has to hold not only the value of record N, but also N - so that you can actually look up the data. And that's a pretty simplistic way of looking at it. Caches may have other metadata to indicate validity and last access time, etc.

示例1:字节的32位地址空间的缓存

每个高速缓存条目具有存储的数据值(8比特)加上地址(32位)= 40位,

Each cache entry has to store the data value (8 bits) plus the address (32bits) = 40 bits,

示例2:32位字的32位地址空间的缓存

每个高速缓存条目具有存储的数据值(32位)加的地址(32位)= 64位,

Each cache entry has to store the data value (32 bits) plus the address (32bits) = 64 bits,

您可以看到,例如#1具有显著更高的开销。

You can see that example #1 has a significantly higher overhead.

与往常一样,***可能会有帮助。 http://en.wikipedia.org/wiki/Cache_(computing

As always, Wikipedia may help. http://en.wikipedia.org/wiki/Cache_(computing)