Ubuntu 查看 CPU 缓存

本文主要介绍了如何在Ubuntu系统中查看CPU的L1、L2、L3缓存大小以及Cache Line(缓存块)的尺寸,详细阐述了CPU缓存的工作原理,强调了缓存是以64字节为单位进行数据读取的。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述

L1 Cache 数据缓存的大小

universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index0/size
32K
universe@AI:~$ 

L1 Cache 指令缓存的大小

universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index1/size
32K
universe@AI:~$ 

L2 Cache 的大小

universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index2/size
256K
universe@AI:~$ 

L3 Cache 的大小

universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index3/size
8192K
universe@AI:~$ 

Cache Line(缓存块)的大小

CPU Cache 的数据是从内存中读取过来的,它是一块一块读取数据的,而不是按照单个数组元素来读取数据的,这样一块一块的数据,称为 Cache Line(缓存块)。

universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size 
64
universe@AI:~$ 
universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size 
64
universe@AI:~$ 
universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size 
64
universe@AI:~$ 
universe@AI:~$ cat /sys/devices/system/cpu/cpu0/cache/index3/coherency_line_size 
64
universe@AI:~$ 

意味着一次载入数据的大小是 64 字节。

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值