为什么在大多数处理器中,L1高速缓存的大小小于L2高速缓存的大小?
为什么在大多数处理器中,L1高速缓存的大小小于L2高速缓存的大小?
Why is the size of L1 cache smaller than that of the L2 cache in most of the processors ?
有不同的原因.
系统中存在L2以加快L1高速缓存未命中的情况.如果L1的大小等于或大于L2的大小,则L2无法容纳比L1多的高速缓存行,并且无法处理L1高速缓存未命中.从设计/成本的角度来看,L1缓存绑定到处理器,并且比L2更快.缓存的整体思想是,通过添加性能比最慢的硬件更好(但更昂贵)但比拥有的快硬件更便宜的中间硬件,可以加快对速度较慢的硬件的访问.即使您决定将L1缓存加倍,也可以增加L2,以加快L1缓存未命中率.
L2 exists in the system to speedup the case where there is a L1 cache miss. If the size of L1 was the same or bigger than the size of L2, then L2 could not accomodate for more cache lines than L1, and would not be able to deal with L1 cache misses. From the design/cost perspective, L1 cache is bound to the processor and faster than L2. The whole idea of caches is that you speed up access to the slower hardware by adding intermediate hardware that is more performing (and expensive) than the slowest hardware and yet cheaper than the faster hardware you have. Even if you decided to double the L1 cache, you would also increment L2, to speedup L1-cache misses.
那么为什么根本没有二级缓存?好吧,L1缓存通常性能更高且构建成本更高,并且它绑定到单个内核.这意味着按固定数量增加L1大小将使该成本乘以双核处理器乘以4,或四核乘以8. L2通常由不同的内核共享-根据架构的不同,它可以在处理器中的几个或所有内核之间共享,因此即使L1和L2的价格相同,增加L2的成本也会较小-不是.
So why is there L2 cache at all? Well, L1 cache is usually more performant and expensive to build, and it is bound to a single core. This means that increasing the L1 size by a fixed quantity will have that cost multiplied by 4 in a dual core processor, or by 8 in a quad core. L2 is usually shared by different cores --depending on the architecture it can be shared across a couple or all cores in the processor, so the cost of increasing L2 would be smaller even if the price of L1 and L2 were the same --which it is not.