时间局部性(temporal locality):指在一段较短时间内,某个数据或指令一旦被访问过,很可能会在不久后再次被访问。它是“局部性原理(locality of reference)”的重要组成部分,常用于解释与设计CPU缓存(cache)、虚拟内存、数据库缓冲等机制。
(另一个常见相关概念是空间局部性:位置相近的数据更可能被一起访问。)
/ˈtɛmpərəl loʊˈkælɪti/
Temporal locality helps explain why caches can speed up programs.
时间局部性有助于解释为什么缓存能够加速程序。
Because the loop repeatedly updates the same variables, the program exhibits strong temporal locality, leading to fewer cache misses.
由于循环反复更新同一组变量,这个程序表现出很强的时间局部性,从而减少了缓存未命中。
temporal 来自拉丁语 tempus(“时间”),表示“与时间有关的”。locality 源自 local(“地方的/局部的”),表示“局部性/局部特征”。合起来 temporal locality 直译为“时间上的局部性”,强调“同一内容在时间上会被重复使用”的倾向。这一术语在计算机体系结构与操作系统领域中被广泛采用,用来概括程序访问行为的规律。