什么是缓存命中和缓存未命中?为什么上下文切换会导致高速缓存未命中? [英] What is a cache hit and a cache miss? Why would context-switching cause cache miss?

查看:315
本文介绍了什么是缓存命中和缓存未命中?为什么上下文切换会导致高速缓存未命中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第11章(性能和可伸缩性)和Context Switching 的部分中的内容-us-east-1.amazonaws.com/"rel =" noreferrer> JCIP图书:

From the 11th Chapter(Performance and Scalability) and the section named Context Switching of the JCIP book:

当新线程被接通时,它所需的数据不太可能是 在本地处理器缓存中,因此上下文切换导致 高速缓存未命中,因此线程在运行时会慢一些 首先安排.

When a new thread is switched in, the data it needs is unlikely to be in the local processor cache, so a context-switch causes a flurry of cache misses, and thus threads run a little more slowly when they are first scheduled.

  1. 有人能以一种易于理解的方式解释缓存未命中的概念及其可能的反义词(缓存命中)吗?
  2. 为什么上下文切换会导致很多缓存丢失?
  1. Can someone explain in an easy to understand way the concept of cache miss and its probable opposite (cache hit)?
  2. Why context-switching would cause a lot of cache miss?

推荐答案

有人能以一种易于理解的方式解释高速缓存未命中的概念及其可能的反义(高速缓存命中)吗?

Can someone explain in an easy to understand way the concept of cache miss and its probable opposite (cache hit)?

一般来说,缓存 miss 是在缓存中查找某些内容但找不到该内容时–缓存中不包含正在查找的项目.缓存 hit 是当您在缓存中查找内容时 存储该项目并能够满足查询的要求.

A cache miss, generally, is when something is looked up in the cache and is not found – the cache did not contain the item being looked up. The cache hit is when you look something up in a cache and it was storing the item and is able to satisfy the query.

为什么上下文切换会导致大量的缓存丢失?

Why context-switching would cause a lot of cache miss?

在内存方面,每个处理器都有一个内存缓存 –小型高速缓存主内存的一部分.当将新线程上下文切换到处理器中时,本地缓存内存为空,或者与该线程所需的数据不对应.这意味着该新线程进行的所有(或大多数)内存查询都会导致高速缓存未命中,因为它需要的数据不是存储在本地内存高速缓存中.然后,硬件必须向内存发出大量请求,以填充本地内存缓存,这会导致线程最初运行速度变慢.

In terms of memory, each processor has a memory cache – a high speed copy of small portions of main memory. When a new thread is context switched into a processor, the local cache memory is empty or it doesn't correspond to the data needed for the thread. This means that all (or most) memory lookups made by that new thread result in cache misses because the data that it needs is not stored in the local memory cache. The hardware has to then make a number of requests to main memory to fill up the local memory cache which causes the thread to initially run slower.

这篇关于什么是缓存命中和缓存未命中?为什么上下文切换会导致高速缓存未命中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆