解释FreeBSD中的CPU缓存分页,特别是分页队列
FreeBSD 实现页面着色 寻呼队列。 队列已安排好 根据尺寸 处理器的 L1 和 L2 缓存; 什么时候 需要分配一个新页面, FreeBSD 试图得到一个 针对缓存进行最佳对齐。
有人可以解释一下上面几行吗,寻呼队列的概念是什么?
谢谢!
FreeBSD implements page coloring with
paging queues. The queues are arranged
according to the size of the
processor’s L1 and L2 caches; and when
a new page needs to be allocated,
FreeBSD tries to get one that is
optimally aligned for the cache.
Can somebody please explain the above lines, what is the concept of paging queues?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
操作系统必须管理 CPU 缓存的大小,以减少缓存未命中(也解释了页面染色)。 更简单地说,必须根据使用频率、是否可能很快再次使用以及重新检索数据的“成本”来仔细选择存储在缓存中的数据(以称为页的单位)。来自主存储器/HD/其他设备的数据。 这些选择对于内存带宽成为瓶颈的应用程序非常重要。
这种类型的事情通常是通过优先级队列来完成的,该优先级队列实现操作系统开发人员选择的分页替换策略。 这些队列决定当新数据移动到缓存时哪些页面被替换,以及数据将位于缓存中的位置。 如果您想了解正在使用什么策略,您应该查阅 FreeBSD 的文档。
为了对齐,高速缓存(或主存储器)中的数据需要从特定边界开始放置,以便有效访问(即移动到 CPU 寄存器中)。 如果数据未对齐,则需要额外的计算来对齐它。
Operating systems have to manage the sizes of CPU caches in order to reduce cache misses (also explains page colouring). More simply, the data stored in the caches (in units called pages) must be carefully selected based on how often it is used, whether it is likely to be used again soon, and how 'expensive' it would be to re-retrieve the data from main memory/HD/SomeOtherDevice. These choices are important in applications where memory bandwidth is a bottleneck.
This type of thing is often done with a priority queue that implements the paging replacement strategy chosen by the OS developers. These queues determine which pages are replaced when new data is moved to the cache, and where the data will be located in the cache. You should consult FreeBSD's documentation if you want to find out what strategy is being used.
For alignment, the data in the cache (or in main memory) needs to be placed started at specific boundaries in order to be accessed efficiently (i.e. to be moved into a CPU register). If data isn't aligned, extra computation is needed to align it.