With persistent memory, applications have a new tier available for data placement as shown in Figure 1. In addition to the memory and storage tiers, the persistent memory tier offers greater capacity than DRAM and significantly faster performance than storage. Applications can access persistent memory resident data structures in-place, like they do with traditional memory, eliminating the need to page blocks of data back and forth between memory and storage.
Figure 1: Memory-Storage Hierarchy with Persistent Memory Tier
To get this low-latency direct access, a new software architecture is required that allows applications to access ranges of persistent memory.
The Persistent Memory Development Kit (PMDK) is a collection of libraries and tools for System Administrators and Application Developers to simplify managing and accessing persistent memory devices. Tuned and validated on both Linux and Windows, the libraries build on the Direct Access (DAX) feature which allows applications to directly access persistent memory as memory-mapped files. This is described in detail in the Storage Network Industry Association (SNIA) NVM Programming Model. Figure 2 shows the model which describes how applications can access persistent memory devices (NVDIMMs) using traditional POSIX standard APIs such as read, write, pread, and pwrite, or load/store operations such as memcpy when the data is memory mapped to the application. The 'Persistent Memory' area describes the fastest possible access because the application I/O bypasses existing filesystem page caches and goes directly to/from the persistent memory media.
Fig 2: SNIA Programming Model
Directly accessing the physical media introduces new programming challenges and paradigms. The PMDK offers application developers many libraries and features highlighted below to solve some of the more difficult programming issues:
libpmem: provides low-level persistent memory support
libpmemobj: provides a transactional object store, providing memory allocation, transactions, and general facilities for persistent memory programming.
libpmemblk: supports arrays of pmem-resident blocks, all the same size, that are atomically updated.
libvmem [deprecated]: turns a pool of persistent memory into a volatile memory pool, similar to the system heap but kept separate and with its own malloc-style API. Since persistent memory support has been integrated into libmemkind, that library is the recommended choice for any volatile implementations. Libmemkind combines support for multiple types of volatile memory into a single, convenient API.
libvmmalloc: library transparently converts all the dynamic memory allocations into persistent memory allocations.
libpmempool: provides support for off-line pool management and diagnostics.
librmem: provides low-level support for remote access to persistent memory utilizing RDMA-capable RNICs.
libvmemcache: is an embeddable and lightweight in-memory caching solution. It's designed to fully take advantage of large capacity memory, such as Persistent Memory with DAX, through memory mapping in an efficient and scalable way.
pmempool: Manage and analyze persistent memory pools with this stand-alone utility
pmemcheck: Use dynamic runtime analysis with an enhanced version of Valgrind for use with persistent memory.
Get Started with Persistent Memory Programming (Series):
The non-volatile memory library (NVML) is now called the Persistent Memory Development Kit (PMDK). In these videos, its architect, Andy Rudoff, introduces you to persistent memory programming and shows you how to apply it to your application.