4 ms·
How would that work at the operating system level, which is where page in and outs occur? You might be able to tell some OS's not to page out a specific page, b
by orf 8y ago
How would that work at the operating system level, which is where page in and outs occur? You might be able to tell some OS's not to page out a specific page, but with variable length data that becomes impossible
- charleslmunger 8y agohttp://man7.org/linux/man-pages/man2/mlock.2.html http://man7.org/linux/man-pages/man2/mlock.2.html at least for linux.
- monocasa 8y agomlock, like VirtualLock, doesn't guarantee that a copy won't go out to disk, only that a copy will always be in RAM.
- charleslmunger 8y agoThe notes section of the page I linked addresses this - it'll only be paged in a hibernate state where memory is powered down. It won't be paged without that.
- monocasa 8y agoThat's just one of many examples. For instance if you're running in a VM, all bets are off, beacuse the host can and will page you out guest phys memory.
- loeg 8y agoHave a separate allocation pool for such objects that uses the mlock syscall on memory ranges it allocates from the OS. As you note, you can't just mlock memory handed out by the ordinary allocator, as you never know when it will be free to munlock.