On Mac OS X, vm_allocate()
allows creation of a purgeable memory region. This region may be reclaimed at any time (other than when it is locked) by the kernel when memory pressure is detected. It is useful for caching data, etc.
I'm wondering if a similar mechanism exists on Linux (kernel 2.6). Google searches lead me to some info on Android discussing allocation of shared memory that may be made purgeable, but I have not seen any talk of API for actually doing this on vanilla Linux. A review of the man pages for mmap
, shmat
, etc, show no flags for setting a purgeable region. Is this functionality available on Linux?
The notes about this feature on Android are here:
MemoryFile Reference
MemoryFile Sample
Thanks!
There is such similar system in 2.6.39-rc1. It is called "Transcendent memory":
Update: There is also short into at wikipedia: 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With