1LIBPMEM2(7) PMDK Programmer's Manual LIBPMEM2(7)
2
3
4
6 libpmem2 - persistent memory support library
7
9 #include <libpmem2.h>
10 cc ... -lpmem2
11
13 libpmem2 provides low-level persistent memory (pmem) support for appli‐
14 cations using direct access storage (DAX), which is storage that sup‐
15 ports load/store access without paging blocks from a block storage de‐
16 vice. Some types of non-volatile memory DIMMs (NVDIMMs) provide this
17 type of byte addressable access to storage. A persistent memory aware
18 file system is typically used to expose the direct access to applica‐
19 tions. Memory mapping a file from this type of file system results in
20 the load/store, non-paged access to pmem.
21
22 This library is for applications that use persistent memory directly,
23 without the help of any library-supplied transactions or memory alloca‐
24 tion. Higher-level libraries that currently build on libpmem (previous
25 variation of libpmem2) are available and are recommended for most ap‐
26 plications, see:
27
28 • libpmemobj(7), a general use persistent memory API, providing memory
29 allocation and transactional operations on variable-sized objects.
30
31 • libpmemblk(7), providing pmem-resident arrays of fixed-sized blocks
32 with atomic updates.
33
34 • libpmemlog(7), providing a pmem-resident log file.
35
36 The libpmem2 library provides a comprehensive set of functions for ro‐
37 bust use of Persistent Memory. It relies on three core concepts:
38 struct pmem2_src source, struct pmem2_config config and struct
39 pmem2_map map:
40
41 • source - an object describing the data source for mapping. The data
42 source can be a file descriptor, a file handle, or an anonymous map‐
43 ping. APIs dedicated for creating source are:
44 pmem2_source_from_fd(3), pmem2_source_from_handle(3),
45 pmem2_source_from_anon(3).
46
47 • config - an object containing parameters that are used to create a
48 mapping from a source. The configuration structure must always be
49 provided to create a mapping, but the only required parameter to set
50 in the config is granularity. The granularity should by set using
51 dedicated libpmem2 function pmem2_config_set_required_store_granular‐
52 ity(3) which defines a maximum permitted granularity requested by the
53 user. For more information about the granularity concept read GRANU‐
54 LARITY section below.
55
56 In addition to the granularity setting, libpmem2 provides multiple op‐
57 tional functions to configure target mapping, e.g., pmem2_con‐
58 fig_set_length(3) to set length which will be used for mapping, or
59 pmem2_config_set_offset(3) which will be used to map the contents from
60 the specified location of the source, pmem2_config_set_sharing(3)