简体   繁体   English

如何计算缓存中的总字节数?

[英]how to calculate total bytes in cache?

I have the question does anyone know how calculate the total amount of bytes in cache if the byte main memory is 2 MB and the block size is 32 Bytes. 我有一个问题,如果字节主内存为2 MB,块大小为32字节,是否有人知道如何计算缓存中的字节总数。 Using direct mapping with 32 lines? 使用32行直接映射?

Really hard to understand what and how it is done. 真的很难理解它是如何完成的。

Thanks. 谢谢。

The purpose here is to cache some of the data the processor needs in memory. 此处的目的是将处理器需要的某些数据缓存在内存中。 Similarly, there may be a cache between the data in the memory and the disk. 同样,内存和磁盘中的数据之间可能存在高速缓存。

In this case, if a data is needed from the disk, the faster memory can be loaded into the memory by booting. 在这种情况下,如果需要磁盘上的数据,则可以通过引导将更快的内存加载到内存中。 There are of course two possibilities: Hit: hit, cache of the processor's request Miss: lost, access to the memory of the processor's request can not be made from the cache. 当然有两种可能:命中:命中,处理器请求的缓存未命中:丢失,无法从缓存访问处理器请求的内存。

The ratios of these numbers also have the following values: hit ratio = hit / hit + miss) Miss ratio = miss / total demand (or hit + loss) For example, suppose that 45 memory access requests and 21 of them are in cache. 这些数字的比率还具有以下值:命中率=命中/命中+丢失)命中率=命中/总需求(或命中+丢失)例如,假设45个内存访问请求中有21个在缓存中。

In this case, miss = 45 - 21 = 24 hit ratio = 21/45 = 47% loss ratio = 24/45 = 53% 在这种情况下,未击中= 45-21 = 24命中率= 21/45 = 47%损失率= 24/45 = 53%

#can you put a plus? #你能加一个吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM