73
© The Author(s) 2020
S. Scargall, Programming Persistent Memory, https://doi.org/10.1007/978-1-4842-4932-1_6
CHAPTER 6
libpmem: Low-Level
Persistent Memory
Support
This chapter introduces libpmem, one of the smallest libraries in PMDK. This C library
is very low level, dealing with things like CPU instructions related to persistent memory,
optimal ways to copy data to persistence, and file mapping. Programmers who only want
completely raw access to persistent memory, without libraries to provide allocators or
transactions, will likely want to use libpmem as a basis for their development.
The code in libpmem that detects the available CPU instructions, for example, is a
mundane boilerplate code that you do not want to invent repeatedly in applications.
Leveraging this small amount of code from libpmem will save time, and you get the
benefit of fully tested and tuned code in the library.
For most programmers, libpmem is too low level, and you can safely skim this
chapter quickly (or skip it altogether) and move on to the higher-level, friendlier
libraries available in PMDK. All the PMDK libraries that deal with persistence, such as
libpmemobj, are built on top of libpmem to meet their low-level needs.
Like all PMDK libraries, online man pages are available. For libpmem, they are at
http://pmem.io/pmdk/libpmem/. This site includes links to the man pages for both the
Linux and Windows version. Although the goal of the PMDK project was to make the
interfaces similar across operating systems, some small differences appear as necessary.
The C code examples used in this chapter build and run on both Linux and Windows.
Précédent

- 101/457

Suivant