是否可以在Ubuntu 14.04上禁用L1和/或L2缓存(最好是在Python等更高级别的语言中)?如果是这样,怎么样?
此外,禁用缓存在不同架构之间会有很大差异吗?如果是这样,我对ARM Cortex-A15更感兴趣.
编辑
在研究如何禁用缓存时,我确实从kernel.org documentation中找到了/ proc / sys / vm /中的“drop_caches”文件
“Writing to this will cause the kernel to drop clean caches, as well as
reclaimable slab objects like dentries and inodes. Once dropped,
their memory becomes free.”…
“This file is not a means to control the growth of the various
kernel caches (inodes, dentries, pagecache, etc…) These objects are
automatically reclaimed by the kernel when memory is needed elsewhere
on the system.”
这看起来不像我正在寻找的东西,因为它不仅不会禁用缓存,我认为虚拟内存驻留在操作系统内而不是硬件上.我的目标是禁用缓存,因此必须在其他地方寻找所需的内存,例如在RAM中.
编辑
为了澄清,我理解禁用缓存会对系统造成什么影响.但是,它是空间应用中常用的技术,可提高安全关键应用的可靠性.以下是记录此现象的一些资源:
Reducing embedded software radiation-induced failures through cache memories
Guideline for Ground Radiation Testing of Microprocessors in the Space Radiation Environment
甚至有关于这个主题的书籍:
Ionizing Radiation Effects in Electronics: From Memories to Imagers
解决方法:
您不能直接在Python中执行此操作,因为您需要内核模块来执行此操作(以及加载该模块的root权限).
有关使L1高速缓存失效所需的内容,请参阅http://lxr.free-electrons.com/source/arch/arm/mm/cache-v7.S#L21(无效,无法禁用).
不同的CPU架构(例如x86与ARM)需要不同的汇编代码(CPU指令)来禁用缓存.我不确定Linux内核是否有可能禁用L1 / L2 / L3 / L4缓存,如果它有这个,我相信它会在内部使用很短的时间,因为CPU很慢没有这些缓存.
有关如何在x86 / x64系统上禁用缓存的链接,请参见Is there a way to disable CPU cache (L1/L2) on a Linux system?(您需要更改寄存器cr0).对于ARM,请检查Cache disabled behavior.
我不确定你完全理解CPU缓存的作用.您能否详细说明为什么要削弱系统的性能?
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!