在Mac OS X上,vm_allocate()允许创建可清除的内存区域.当检测到记忆压力时,内核可以在任何时间(除非被锁定时)被内核回收.它对于缓存数据等非常有用.
我想知道Linux(内核2.6)上是否存在类似的机制.谷歌搜索引导我在Android上讨论可能被清除的共享内存分配的一些信息,但我还没有看到任何有关在vanilla Linux上实际执行此操作的API的讨论.对mmap,shmat等的手册页的检查显示没有用于设置可清除区域的标志. Linux上是否提供此功能?
Android上有关此功能的说明如下:
谢谢!
> 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 accessibleOne 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.