Linux上的可清除内存区域

前端之家收集整理的这篇文章主要介绍了Linux上的可清除内存区域前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在Mac OS X上,vm_allocate()允许创建可清除的内存区域.当检测到记忆压力时,内核可以在任何时间(除非被锁定时)被内核回收.它对于缓存数据等非常有用.

我想知道Linux(内核2.6)上是否存在类似的机制.谷歌搜索引导我在Android上讨论可能被清除的共享内存分配的一些信息,但我还没有看到任何有关在vanilla Linux上实际执行此操作的API的讨论.对mmap,shmat等的手册页的检查显示没有用于设置可清除区域的标志. Linux上是否提供此功能

Android上有关此功能的说明如下:

MemoryFile Reference

MemoryFile Sample

谢谢!

最佳答案
2.6.39-rc1中有类似的系统.它被称为“超越记忆”:

> Transcendent memory,2009
> Transcendent memory in a nutshell,2011
> 2011年的幻灯片Transcendent Memory
and Friends,TmemNotVirt-Linuxcon2011-Final.pdf
(它还列出了一些类似的术语)
> oss.oracle的Api规范:Transcendent Memory Interface Specification
Version 0.0.1 – 081202

更新:维基百科还有一个短片:https://en.wikipedia.org/wiki/Transcendent_memory

In computing,transcendent memory (aka “tmem”) is a concept explored by Dan Magenheimer.
Transcendent memory is a class of memory that is of unknown and dynamically variable size,is addressable only indirectly by the kernel,can be configured either as persistent or as “ephemeral” (meaning it will be around for a while,but might disappear without warning),and is still fast enough to be synchronously accessible

One can think of transcendent memory as a sort of RAM disk with some interesting characteristics: nobody knows how big it is,writes to the disk may not succeed,and,potentially,data written to the disk may vanish before being read back again. At a first blush,it may seem like a relatively useless sort of device,but it is hoped that transcendent memory will be able to improve performance in a few situations.

Introduced in Linux kernel 2.6.39.[1][2] Implementation by Dan Magenheimer of Oracle Corporation. Xen 4.0 supports tmem in the hypervisor.

猜你在找的Linux相关文章