Easier Persistent Memory Programming with Extensions to libstdc++ and libc++


Persistent memory, unlike volatile memory, retains its contents even if the server has a power failure. However, as Tomasz Kapela, Software Engineer at Intel, points out during his LinuxCon Europe 2016 talk, persistent memory is hard to achieve. Since persistent memory programming is non-trivial, they have been focused on making it easier for the end user and for applications to use persistent memory correctly. 

Kapela starts off by describing the Non-Volatile Memory (NVM) programming model created by the Storage Networking Industry Association (SNIA), which is an organization focused on standards for storage and networking. The NVM programming model basically describes using a persistent memory device that allows you to mmap a file to your virtual memory inside of the process where you can do loads and stores and flushes onto the memory device without really involving the kernel of the file system. 

As part of the NVML team, they have a set of open source libraries designed to work on Linux and tackle the problem of persistent memory programming. The libraries include:

  • libpmem: The basic library, flush to persistence
  • libvmem: Volatile Memory Allocator
  • libvmmalloc: Transparent use of libvmem
  • libpmemblk: Persistent memory carved into blocks
  • libpmemlog: Log file (append-mostly)
  • libpmemobj: Transactional Object Store

To address some of the pain points and limitations of using C for persistent memory, Kapela discussed how they are using C++ to develop persistent memory extensions to libstdc++ and libc++. He talked in detail about how they are encapsulating type info into a smart pointer, and making life easier with RAII and lambdas for transactions. With the increase in container usage, they are also working on a proof of concept for persistent memory containers. 

Watch the video of Kapela’s entire talk to get all of the details about the persistent memory extensions to libstdc++ and libc++.


Interested in speaking at Open Source Summit North America on September 11-13? Submit your proposal by May 6, 2017. Submit now>>

Not interested in speaking but want to attend? Linux.com readers can register now with the discount code, LINUXRD5, for 5% off the all-access attendee registration price. Register now to save over $300!