I have to write a simple key-value store for a very specific use. This store will be running in the same memory space as the process that uses it.
One requirement for this store is that it is kept in RAM and it has to be as fast as possible. We haven’t decided for a data structure but we might be using a LLRB-Tree.
How can I make sure that my data structure will always be kept in RAM? Not swapped, not paged, not cached somewhere else but exclusively in-memory.
If you use Linux, then check
mlock()