<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on PMem.io</title><link>https://pmem.io/blog/</link><description>Recent content in Blog on PMem.io</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 25 May 2023 13:46:31 +0200</lastBuildDate><atom:link href="https://pmem.io/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>Exploring the Software Ecosystem for Compute Express Link (CXL) Memory</title><link>https://pmem.io/blog/2023/05/exploring-the-software-ecosystem-for-compute-express-link-cxl-memory/</link><pubDate>Thu, 25 May 2023 13:46:31 +0200</pubDate><guid>https://pmem.io/blog/2023/05/exploring-the-software-ecosystem-for-compute-express-link-cxl-memory/</guid><description>&lt;h2 id="cxl-software-ecosystem">CXL Software ecosystem&lt;/h2>
&lt;p>The Compute Express Link (CXL) is going to be a transformative new technology
in the heterogeneous memory space. While the transition from
Persistent Memory (PMem) to CXL.mem may seem challenging at first, developers who have
optimized their applications for PMem will find that no significant changes
may be required. In this article, we will explore the CXL software ecosystem
and its compatibility with the established PMem concepts and libraries.&lt;/p></description></item><item><title>Dockers usage in PMDK</title><link>https://pmem.io/blog/2022/12/dockers-usage-in-pmdk/</link><pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/12/dockers-usage-in-pmdk/</guid><description>&lt;p>In this blog post, I&amp;rsquo;ll describe why we believe dockers are easy to use, time-saving, and valuable for
day-to-day programming and debugging. If you have never heard of dockers (or containers in general),
please read, for example, &lt;a href="https://docs.docker.com/get-started/overview/">this overview&lt;/a>. We use dockers
in almost all of the repositories in our organization. In this blog post, I will describe how we use
dockers based on the &lt;a href="https://github.com/pmem/pmdk">PMDK&lt;/a> repository. In some of our repositories,
like in &lt;a href="https://github.com/memkind/memkind">memkind&lt;/a>, we use a bit different approach, but it
still relies on docker. The section &lt;a href="https://pmem.io/blog/2022/12/dockers-usage-in-pmdk/#our-various-solutions">&amp;ldquo;Our various solutions&amp;rdquo;&lt;/a> below
describes some differences between our repositories. Let&amp;rsquo;s get to the details!&lt;/p></description></item><item><title>Update on PMDK and our long term support strategy</title><link>https://pmem.io/blog/2022/11/update-on-pmdk-and-our-long-term-support-strategy/</link><pubDate>Wed, 16 Nov 2022 00:00:00 +0200</pubDate><guid>https://pmem.io/blog/2022/11/update-on-pmdk-and-our-long-term-support-strategy/</guid><description>&lt;p>Following Intel’s Q2 earnings call announcing the wind-down of Intel’s Optane business, Intel will also be winding down its investment in new feature development on Persistent Memory Development Kit (PMDK) libraries and adjusting long-term support and maintenance plans accordingly.&lt;/p>
&lt;p>The PMDK collection of open-source libraries and tools hosted on GitHub will continue to be available to the software community. Documentation and resources via the pmem.io website will also remain available.&lt;/p></description></item><item><title>Introduction to libpmem2 (part 1)</title><link>https://pmem.io/blog/2022/06/introduction-to-libpmem2-part-1/</link><pubDate>Thu, 30 Jun 2022 10:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/06/introduction-to-libpmem2-part-1/</guid><description>&lt;h2 id="a-new-beginning">A new beginning&lt;/h2>
&lt;p>This blog post will be about the recently created library &lt;a href="https://pmem.io/pmdk/manpages/linux/master/libpmem2/libpmem2.7/">libpmem2&lt;/a>,
which is a part of PMDK repository. Before we go into details it&amp;rsquo;s worth having a short look
at the history. About seven years ago, the first persistent memory library
known as &lt;a href="https://pmem.io/pmdk/manpages/linux/master/libpmem/libpmem.7/">libpmem&lt;/a> was started. The concept of persistent
memory was becoming a reality. Initially, libpmem provided simple support
for memory memory management on pmem.
Over time, the development of hardware, software, as well as changing customer needs made it
necessary to evolve the library to include new features such as support for Windows,
&lt;a href="https://pmem.io/glossary/">DevDax, RAS, eADR&lt;/a>, and others. The initial API design was no longer
sufficient and it wasn&amp;rsquo;t flexible enough to extend.
This led us to create an improved version of libpmem: &lt;strong>libpmem2&lt;/strong>.&lt;/p></description></item><item><title>Memory Tiering (part 2): Writing Transparent Tiering Solution</title><link>https://pmem.io/blog/2022/06/memory-tiering-part-2-writing-transparent-tiering-solution/</link><pubDate>Wed, 29 Jun 2022 00:00:00 +0200</pubDate><guid>https://pmem.io/blog/2022/06/memory-tiering-part-2-writing-transparent-tiering-solution/</guid><description>&lt;p>This is the second part of the series of articles about memory tiering. &lt;a href="https://pmem.io/blog/2022/06/memory-tiering-part-1/">The first one&lt;/a> explained what memory tiering is and why we need it, the second one will explain some mechanisms behind transparent tiering.&lt;/p>
&lt;p>This article is intended for those who would like to learn how tiering/numa
balancing or memory profiling solutions work under the hood. We will focus
on a high-level overview of how tiering/numa balancing could be designed,
instead of dissecting any particular solution. This approach means that
the readers can also learn some general knowledge on topics such as Linux
API, hardware-accelerated performance monitoring or architecture of Linux apps.&lt;/p></description></item><item><title>Memory Tiering (part 1)</title><link>https://pmem.io/blog/2022/06/memory-tiering-part-1/</link><pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/06/memory-tiering-part-1/</guid><description>&lt;h2 id="extending-memory-capacity-with-pmem">Extending memory capacity with PMEM&lt;/h2>
&lt;p>Databases such as &lt;a href="https://github.com/redis/redis">Redis&lt;/a> (an in-memory key-value open-source database) consume a lot of memory.
Since fast access is essential for them, they use DRAM to store their data.
DRAM is quite expensive and has limited capacity, so a solution we propose in this blog post is to use PMEM
(and in the future other types of memory available through CXL - see a &lt;a href="https://pmem.io/blog/2022/01/disaggregated-memory-in-pursuit-of-scale-and-efficiency">pmem.io blog post about it&lt;/a>).
PMEM can be used in two modes - &lt;a href="https://pmem.io/glossary/#memory-mode">Memory Mode&lt;/a> and &lt;a href="https://pmem.io/glossary/#app-direct">App Direct&lt;/a>. In Memory Mode,
user sees DRAM and PMEM memory as single, combined memory node. In App Direct mode,
when user &lt;a href="https://pmem.io/blog/2020/01/memkind-support-for-kmem-dax-option">configures PMEM as KMEM DAX&lt;/a>, the PMEM memory will be directly available in the system and visible
as a separate NUMA node without a CPU.&lt;/p></description></item><item><title>Similarity Search - opportunity for PMEM</title><link>https://pmem.io/blog/2022/06/similarity-search-opportunity-for-pmem/</link><pubDate>Tue, 21 Jun 2022 00:00:00 +0200</pubDate><guid>https://pmem.io/blog/2022/06/similarity-search-opportunity-for-pmem/</guid><description>&lt;p>At a high level, computing solves problems. These problems, even though
different and individual, are sometimes somehow related. A new algorithmic
challenge can usually be solved by bringing it down to a well-defined problem
with an existing solution. Today, we will be talking about one of such
universal solutions - similarity search, which has found its application
in various areas of life, from search engines that tell us what we want
to find, through recommendation engines that tell us what to watch, where
to eat and what to buy, all the way to data science that provides valuable
input to business decisions.&lt;/p></description></item><item><title>Basic asynchronous hashmap with Miniasync library</title><link>https://pmem.io/blog/2022/06/basic-asynchronous-hashmap-with-miniasync-library/</link><pubDate>Fri, 03 Jun 2022 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/06/basic-asynchronous-hashmap-with-miniasync-library/</guid><description>&lt;p>Miniasync library provides a framework for the composition and execution of asynchronous
tasks in C. To accommodate different user-defined tasks and various types of data that they
take in, libminiasync makes use of macros.&lt;/p>
&lt;p>Using libminiasync for the first time can be challenging. There are multiple examples
on the &lt;a href="https://github.com/pmem/miniasync/tree/master/examples">miniasync repo&lt;/a> to make it easier. One of them is a
&lt;a href="https://github.com/pmem/miniasync/blob/master/examples/hashmap/hashmap.c">hashmap&lt;/a> example.&lt;/p>
&lt;h2 id="hashmap-example-overview">Hashmap example overview&lt;/h2>
&lt;p>The hashmap example on the Miniasync repository presents a hashmap with a fixed size that
allocates memory upon key-value pair insertion. This particular implementation uses
linear probing for hashmap entry lookup. Linear probing means that whenever we encounter a
collision when inserting a key-value pair, we will move on to the next hashmap entry until
we find an unoccupied entry. For the hash function, we use the Austin Appleby &lt;a href="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash3&lt;/a>
64-bit finalizer.&lt;/p></description></item><item><title>Upcoming asynchronous interfaces in PMDK libraries</title><link>https://pmem.io/blog/2022/05/upcoming-asynchronous-interfaces-in-pmdk-libraries/</link><pubDate>Wed, 11 May 2022 10:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/05/upcoming-asynchronous-interfaces-in-pmdk-libraries/</guid><description>&lt;p>In the &lt;a href="https://pmem.io/blog/2022/02/leveraging-asynchronous-hardware-accelerators-for-fun-and-profit/">previous article&lt;/a>, I wrote about a new upcoming Xeon platform feature,
Data Streaming Accelerator (DSA) - a memory-to-memory DMA engine, and what opportunities
and challenges it presents. I outlined the approach we are taking in
Persistent Memory Development Kit (PMDK) to expose asynchronous APIs that can
take advantage of this new hardware. Lastly, I introduced libminiasync, which
is our framework for abstracting asynchronous operations.&lt;/p>
&lt;p>This time, I will discuss how miniasync is being used in libpmem2 and our plans for its integration into the rest of PMDK libraries.&lt;/p></description></item><item><title>Leveraging asynchronous hardware accelerators for fun and profit</title><link>https://pmem.io/blog/2022/02/leveraging-asynchronous-hardware-accelerators-for-fun-and-profit/</link><pubDate>Mon, 28 Feb 2022 10:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/02/leveraging-asynchronous-hardware-accelerators-for-fun-and-profit/</guid><description>&lt;p>One of the greatest benefits of Persistent Memory is that it&amp;rsquo;s directly
accessible by the CPU. But that can also be one of its downsides for
specific use cases. For example, if you want to use PMem as an ultra-fast
storage device with low access latency.&lt;/p>
&lt;h2 id="pmem-as-storage-impedance-mismatch">PMem as storage impedance mismatch&lt;/h2>
&lt;p>The reason for that is simple - block storage I/O is typically asynchronous due
to its relatively high latency and high queue depths required to reach optimal
throughputs. This led to developers optimizing software for concurrent access to
the storage devices, either directly through asynchronous APIs like
&lt;a href="https://kernel.dk/io_uring.pdf">&lt;code>io_uring&lt;/code>&lt;/a> or indirectly by relying on kernel&amp;rsquo;s built-in mechanisms such as
page caching or buffering. And now enter Persistent Memory, where the most
natural way of accessing it is synchronously with the CPU. This creates a mismatch
in storage use cases between what the software expects, an offloaded
background I/O operation, and what is actually happening, a synchronous memory copy.&lt;/p></description></item><item><title>Introduction to pmemstream</title><link>https://pmem.io/blog/2022/01/introduction-to-pmemstream/</link><pubDate>Wed, 26 Jan 2022 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2022/01/introduction-to-pmemstream/</guid><description>&lt;h1 id="what-is-pmemstream">What is pmemstream?&lt;/h1>
&lt;p>Libpmemstream implements a pmem-optimized log data structure and provides stream-like access to data.
It presents a contiguous logical address space, divided into regions, with log entries of arbitrary size.
We intend for this library to be a foundation for various, more complex higher-level solutions. Read on
to learn about a few example use cases we have in mind. Like most libraries in the PMDK family, this one
also focuses on delivering a generic, easy-to-use set of functions.&lt;/p></description></item><item><title>Disaggregated Memory - In pursuit of scale and efficiency</title><link>https://pmem.io/blog/2022/01/disaggregated-memory-in-pursuit-of-scale-and-efficiency/</link><pubDate>Fri, 21 Jan 2022 10:00:00 +0100</pubDate><guid>https://pmem.io/blog/2022/01/disaggregated-memory-in-pursuit-of-scale-and-efficiency/</guid><description>&lt;p>A software person perspective on new upcoming interconnect technologies.&lt;/p>
&lt;h2 id="existing-server-landscape">Existing Server Landscape&lt;/h2>
&lt;p>Servers are expensive. And difficult to maintain properly. That&amp;rsquo;s why most
people turn to the public cloud for their hosting and computing needs. Dynamic
virtual server instances have been key to unlocking efficiency gains for
both Cloud Service Providers (CSPs) and their users. CSPs can leverage
virtualization to colocate many workloads on fewer physical servers. And cloud
users have access to a huge pool of on-demand processing power, only having to
pay for what they use. It&amp;rsquo;s a win-win scenario in terms of efficiency.
More people share fewer resources.&lt;/p></description></item><item><title>How to Contribute to pmem.io</title><link>https://pmem.io/blog/2021/10/how-to-contribute-to-pmem.io/</link><pubDate>Thu, 07 Oct 2021 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2021/10/how-to-contribute-to-pmem.io/</guid><description>&lt;h1 id="contributing-to-this-repository">Contributing to this repository&lt;/h1>
&lt;h4 id="this-entry-was-edited-on-2022-07-22-to-update-code-of-conduct-link-and-add-a-link-to-contributing-guide">[This entry was edited on 2022-07-22 to update Code of Conduct link and add a link to Contributing guide]&lt;/h4>
&lt;blockquote>
&lt;p>Please note that this blog post is a snapshot of our CONTRIBUTING file. For always up-to-date information, please see
&lt;a href="https://github.com/pmem/pmem.github.io/blob/main/CONTRIBUTING.md">guideline file on repository with content of this website&lt;/a>.&lt;/p>
&lt;/blockquote>
&lt;h2 id="getting-started">Getting started&lt;/h2>
&lt;p>Before you begin:&lt;/p>
&lt;ul>
&lt;li>The &lt;a href="https://pmem.io">pmem.io&lt;/a> website is powered by the &lt;a href="https://gohugo.io/">Hugo&lt;/a> static site generator and hosted on &lt;a href="https://pages.github.com/">GitHub Pages&lt;/a>.&lt;/li>
&lt;li>Have you read the &lt;a href="https://github.com/pmem/pmem.github.io/blob/main/CODE_OF_CONDUCT.md">code of conduct&lt;/a>?&lt;/li>
&lt;li>Review the &lt;a href="https://github.com/pmem/pmem.github.io/issues">existing issues&lt;/a> and see if we &lt;a href="https://pmem.io/blog/2021/10/how-to-contribute-to-pmem.io/#types-of-contributions">accept contributions&lt;/a> for your type of issue.&lt;/li>
&lt;/ul>
&lt;h2 id="types-of-contributions">Types of contributions&lt;/h2>
&lt;p>You can contribute to the pmem.io content and website in several ways. This GitHub repository is a place to discuss and collaborate on pmem.io! A small, but mighty team is maintaining this repo. To preserve our bandwidth, off topic conversations will be closed.&lt;/p></description></item><item><title>Libpmemobj-cpp - lessons learned</title><link>https://pmem.io/blog/2021/09/libpmemobj-cpp-lessons-learned/</link><pubDate>Thu, 30 Sep 2021 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2021/09/libpmemobj-cpp-lessons-learned/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>We&amp;rsquo;ve been working on C++ bindings for &lt;em>libpmemobj&lt;/em> since around 2016 - see our &lt;a href="https://pmem.io/2016/01/12/cpp-01.html">very first
tutorial for libpmemobj-cpp&lt;/a>. We&amp;rsquo;ve come a long way since then. A lot has
changed - we&amp;rsquo;ve gained more experience and knowledge, added new features, fixed quite a few
bugs, and created at least half a dozen new containers. It&amp;rsquo;s fair to state this product is now
far more mature and well-developed. Over time, we&amp;rsquo;ve learned at least several lessons about
designing and overcoming issues in C++ applications for persistent memory. We want to share
them with you to learn from &lt;strong>our&lt;/strong> mistakes and not waste any time.&lt;/p></description></item><item><title>Concurrency considerations in libpmemobj-cpp</title><link>https://pmem.io/blog/2021/09/concurrency-considerations-in-libpmemobj-cpp/</link><pubDate>Fri, 17 Sep 2021 00:00:00 +0000</pubDate><guid>https://pmem.io/blog/2021/09/concurrency-considerations-in-libpmemobj-cpp/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Ensuring data consistency on pmem is a challenging task. It gets even more
complicated if data is modified concurrently. This blog post describes several
challenges related to data visibility, using transactions in multi-threaded
environments, and memory leaks.&lt;/p>
&lt;h3 id="lock-free-programming-on-pmem">Lock-free programming on pmem&lt;/h3>
&lt;p>A fundamental issue (if &lt;a href="https://pmem.io/glossary/#eadr">eADR&lt;/a> is not used) is data visibility. When a
thread issues a temporal (e.g., MOV) store instruction, the modification might
be visible to other threads before it is persistent (data can still be in a CPU
cache). Consider the following scenario with one thread writing to a variable
using atomic operations and the second one reading from it:&lt;/p></description></item><item><title>Memkind support for heterogeneous memory attributes</title><link>https://pmem.io/blog/2021/05/memkind-support-for-heterogeneous-memory-attributes/</link><pubDate>Wed, 12 May 2021 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2021/05/memkind-support-for-heterogeneous-memory-attributes/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Memkind is a library mostly associated with enabling &lt;a href="https://pmem.io/blog/2020/01/introduction-to-libmemkind">Persistent Memory&lt;/a>.
However, it is not the only type of memory that memkind supports.
The library is a general solution designed for platforms with heterogeneous memory.&lt;/p>
&lt;p>But before we delve into heterogeneous memory itself, let&amp;rsquo;s start with a short recap about &lt;a href="https://software.intel.com/content/www/us/en/develop/articles/optimizing-applications-for-numa.html">NUMA&lt;/a>.
The NUMA concept solved the problem of a dynamic extension of the CPU count per socket and system memory.
Before NUMA, Uniform Memory Access (UMA) was a common model, in which all processors shared physical memory uniformly.
With the UMA approach and a rapid growth of a number of processors and memory in multi-socket machines, platforms faced scalability problems.
A single shared bus connecting all CPU(s) and DRAM memory became a bottleneck, as each CPU decreased the available bandwidth.
To handle each new device, the length of the bus had to be extended, which in turn negatively impacted the latency.&lt;/p></description></item><item><title>Using Memkind in Hazelcast</title><link>https://pmem.io/blog/2021/02/using-memkind-in-hazelcast/</link><pubDate>Thu, 11 Feb 2021 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2021/02/using-memkind-in-hazelcast/</guid><description>&lt;p>This blog post is published on the Hazelcast &lt;a href="https://hazelcast.com/blog/using-memkind-in-hazelcast/">blog&lt;/a> as well.
If interested in Hazelcast, check the other posts there too.&lt;/p>
&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>The mission of the PMDK team has always been and will always be to make programming persistent memory
easier for the community of software developers. One of our goals is to help simplify the integration
of persistent memory into software solutions by making it transparent as possible.
Adopting ground-breaking and disruptive technology creates a chasm, which is
challenging to cross at first. To help with that, PMDK offers a multi-layered stack of solutions
so that developers can choose a library that is the best fit for their desired level of abstraction and purpose.&lt;/p></description></item><item><title>API overview of pmemkv-java binding</title><link>https://pmem.io/blog/2020/10/api-overview-of-pmemkv-java-binding/</link><pubDate>Fri, 30 Oct 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/10/api-overview-of-pmemkv-java-binding/</guid><description>&lt;p>Pmemkv is a key-value data store written in C and C++, however, it also opens up
a way to leverage persistent memory by developers who prefer high-level languages - such as Java.
For more information about other bindings please read &lt;a href="https://pmem.io/blog/2020/03/language-bindings-for-pmemkv/">Language bindings for pmemkv&lt;/a>
article and &lt;a href="https://github.com/pmem/pmemkv/#language-bindings">pmemkv README&lt;/a>&lt;/p>
&lt;p>We built an API for pmemkv-java binding on top of libpmemkv 1.0 API, but java binding
is also compatible with newer versions of libpmemkv. You don’t have to worry
about the dependencies, because packages from the OS vendor’s repositories suffice.&lt;/p></description></item><item><title>TieredMemDB - Redis with Persistent Memory</title><link>https://pmem.io/blog/2020/09/tieredmemdb-redis-with-persistent-memory/</link><pubDate>Fri, 25 Sep 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/09/tieredmemdb-redis-with-persistent-memory/</guid><description>&lt;h6 id="14-jan-2022-note-this-blog-post-has-been-updated-due-to-the-renaming-of-our-database-from-memkeydb-to-tieredmemdb">[14-Jan-2022 Note: this blog post has been updated due to the renaming of our database from MemKeyDB to TieredMemDB]&lt;/h6>
&lt;h1 id="context">Context&lt;/h1>
&lt;p>Redis is an in-memory database that supports various data-structures and stores
them in main memory. To support data durability, Redis relies on creating
periodical snapshots of data or logging all commands that reach the server.&lt;/p>
&lt;p>When Persistent Memory was first introduced, we&amp;rsquo;ve started working on various
approaches of using it in Redis. Apart from using its persistence, we also had
its huge capacity at our disposal.&lt;/p></description></item><item><title>Static code analysis of the PMDK</title><link>https://pmem.io/blog/2020/08/static-code-analysis-of-the-pmdk/</link><pubDate>Thu, 20 Aug 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/08/static-code-analysis-of-the-pmdk/</guid><description>&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>In the PMDK team, we focus on the quality of our codebase. One of the
standard practices in the software development is a static code analysis, which
improves the overall project quality and fixes bugs in the early stage of
development. Since there is no silver bullet for avoiding bugs, we already use
two different static analysis tools and many runtime checkers e.g. &lt;a href="https://www.youtube.com/watch?v=R2m-wH7W-5U">valgrind&lt;/a>.
Improving static analysis effectiveness is a separate academic problem. What is
worth mentioning is the fact that different tools take a various approach. With
combined advantages of Open Source projects such as transparency and
reliability, as well as a new static analysis tool, we get a new bag of tricks
and a fresh look to an old problem :).&lt;/p></description></item><item><title>Introduction to LLPL</title><link>https://pmem.io/blog/2020/05/introduction-to-llpl/</link><pubDate>Wed, 27 May 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/05/introduction-to-llpl/</guid><description>&lt;p>There are several ways to program with persistent memory from Java. A
&lt;a href="https://pmem.io/blog/2020/03/language-bindings-for-pmemkv">recent pmem.io blog article&lt;/a>
described the pmemkv library, a persistent key-value store, which can be used
from multiple languages. For Java, pmemkv supports three ubiquitous
Java types: String, byte[], and ByteBuffer.&lt;/p>
&lt;p>Another PMDK component, the Low-Level Persistence Library (LLPL) is an
open source Java library &lt;a href="https://github.com/pmem/llpl">(https://github.com/pmem/llpl)&lt;/a> that
gives Java developers access to persistent memory in a very fast and flexible way.
This article will introduce LLPL by way of Java examples that show how
to manage and access persistent memory using the library.&lt;/p></description></item><item><title>300 nanoseconds (2 of 2)</title><link>https://pmem.io/blog/2020/03/300-nanoseconds-2-of-2/</link><pubDate>Thu, 26 Mar 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/03/300-nanoseconds-2-of-2/</guid><description>&lt;p>At the end of the &lt;a href="https://pmem.io/blog/2019/12/300-nanoseconds-1-of-2">first&lt;/a> part of
this blog series, I posed three fundamental questions regarding the design of
&lt;em>failure atomic data structures&lt;/em> for persistent memory.&lt;/p>
&lt;ol>
&lt;li>What does it mean to allocate persistent memory?&lt;/li>
&lt;li>How to do fail-safe atomic updates?&lt;/li>
&lt;li>Are all data structures suitable for persistent memory?&lt;/li>
&lt;/ol>
&lt;p>This time around, I will try to answer these questions to the best of my ability.
We will return to the doubly-linked list example to see how it can be
modified for PMEM. Finally, I will briefly discuss the evolution of
libpmemobj as we refined its internal algorithms for the best performance.&lt;/p></description></item><item><title>Language bindings for pmemkv</title><link>https://pmem.io/blog/2020/03/language-bindings-for-pmemkv/</link><pubDate>Wed, 04 Mar 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/03/language-bindings-for-pmemkv/</guid><description>&lt;p>&lt;a href="https://pmem.io/pmemkv/">pmemkv&lt;/a> is a local/embedded key-value datastore optimized for persistent memory.
It is written in C and C++, but to satisfy a wider audience it comes with several bindings
for high-level languages. Currently: Java (with JNI), Node.js, Python and Ruby.&lt;/p>
&lt;p>The picture below illustrates architecture and software stack of pmemkv and its bindings.
&lt;img src="https://pmem.io/images/posts/pmemkv_bindings.png" alt="pmemkv_bindings_image">&lt;/p>
&lt;p>The most up-to-date information about pmemkv and its bindings is located in
&lt;a href="https://github.com/pmem/pmemkv/#language-bindings">pmemkv&amp;rsquo;s README file&lt;/a>.&lt;/p>
&lt;h3 id="common-for-bindings">Common for bindings&lt;/h3>
&lt;p>There are few common characteristics of all bindings:&lt;/p></description></item><item><title>Introduction to libmemkind</title><link>https://pmem.io/blog/2020/01/introduction-to-libmemkind/</link><pubDate>Mon, 20 Jan 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/01/introduction-to-libmemkind/</guid><description>&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>Memkind is the library that simplify usage of persistent memory in a
volatile mode. There are NVDIMMs technologies, such as Intel Optane DCPMM, that
provides persistency, byte-addressability, and also a high capacity when
compared with DRAM modules. They can be used as an
expansion of main memory and utilized by applications which consume
a large amount of memory and do not require persistency, such as in-memory
databases, caching engines and scientific simulations.&lt;/p></description></item><item><title>Memkind support for KMEM DAX option</title><link>https://pmem.io/blog/2020/01/memkind-support-for-kmem-dax-option/</link><pubDate>Mon, 20 Jan 2020 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2020/01/memkind-support-for-kmem-dax-option/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Linux kernel version 5.1 brings in &lt;a href="https://patchwork.kernel.org/cover/10829019/">support&lt;/a> for the volatile-use of persistent memory
as a hotplugged memory region (&lt;strong>KMEM DAX&lt;/strong>).
When this feature is enabled, persistent memory is seen as a separate memory-only NUMA node(s).
&lt;a href="https://github.com/memkind/memkind/releases/tag/v1.10.0">libmemkind&lt;/a> API was extended to include new kinds that allow for automatic detection and allocation
from these new persistent memory NUMA nodes.&lt;/p>
&lt;h3 id="requirements">Requirements&lt;/h3>
&lt;p>&lt;span>1.&lt;/span> Kernel 5.1 with &lt;strong>KMEM DAX&lt;/strong> driver enabled.&lt;/p>
&lt;p>If support of &lt;strong>KMEM DAX&lt;/strong> driver isn&amp;rsquo;t enabled in your kernel you will have to configure
proper driver installation by run &lt;code>nconfig&lt;/code> and enable driver.&lt;/p></description></item><item><title>300 nanoseconds (1 of 2)</title><link>https://pmem.io/blog/2019/12/300-nanoseconds-1-of-2/</link><pubDate>Thu, 19 Dec 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/12/300-nanoseconds-1-of-2/</guid><description>&lt;p>Educating people has always been a challenge for me. I tend to skip over things
I wrongly consider obvious, or do large leaps in reasoning when explaining a
solution to a problem. And so, when faced with an attempt to explain a complex
topic, I tend to ramble on and on, hoping that the audience knows when to interrupt
me if I go too fast. However, this doesn&amp;rsquo;t hold true for blog posts, such as the one I&amp;rsquo;m
currently writing. This is why I have a request to you, the reader,
please do let me know if I went too fast on this one - thanks!&lt;/p></description></item><item><title>Vmem is split out of PMDK</title><link>https://pmem.io/blog/2019/10/vmem-is-split-out-of-pmdk/</link><pubDate>Thu, 31 Oct 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/10/vmem-is-split-out-of-pmdk/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>We have just split &lt;strong>libvmem&lt;/strong> and its companion &lt;strong>libvmmalloc&lt;/strong> out of the
PMDK tree. They now live in a
&lt;a href="https://github.com/pmem/vmem/">separate repository&lt;/a>, and will follow their
own release cadence. And, as these libraries are considered mature and
finished, no new releases are planned once the split has been tested and
tagged &amp;ndash; except for defects and new requirements of underlying platforms.&lt;/p>
&lt;h3 id="further-development">Further development&lt;/h3>
&lt;p>&lt;strong>libvmem&lt;/strong> remains the only way to use filesystem-managed persistent memory
for volatile allocations on Windows.&lt;/p></description></item><item><title>New release of PMDK</title><link>https://pmem.io/blog/2019/10/new-release-of-pmdk/</link><pubDate>Fri, 11 Oct 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/10/new-release-of-pmdk/</guid><description>&lt;p>If you are following our mailing group, you&amp;rsquo;ve probably noticed a stream of
release announcements for libraries that are a part of PMDK. Here&amp;rsquo;s a recap
of the most important new features and additions.&lt;/p>
&lt;h2 id="libpmemkv-10">libpmemkv 1.0&lt;/h2>
&lt;p>The primary goal of PMDK is enabling adoption of Persistent Memory. We do so
by creating the building blocks that applications can utilize to support PMEM.
So far, our work was mostly concentrated on important base functionality such as
memory allocation or transactions, and only recently we&amp;rsquo;ve started to build
on that foundation with C++ containers - making persistent memory programming
easier and easier.&lt;/p></description></item><item><title>C++ standard limitations and Persistent Memory</title><link>https://pmem.io/blog/2019/10/c-standard-limitations-and-persistent-memory/</link><pubDate>Fri, 04 Oct 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/10/c-standard-limitations-and-persistent-memory/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>C++ language restrictions and the persistent memory programming paradigm imply
serious restrictions on objects which may be stored on persistent medium. A user can access
persistent memory with memory mapped files to take advantage of its byte addressability thanks
to libpmemobj and Storage Networking Industry Association non-volatile
memory programming model. No serialization takes place here, thus applications must be able
to read and modify directly from the medium even after application was closed and reopened or
after the event of power loss.&lt;/p></description></item><item><title>Multi-level vmemcache</title><link>https://pmem.io/blog/2019/06/multi-level-vmemcache/</link><pubDate>Wed, 12 Jun 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/06/multi-level-vmemcache/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>&lt;strong>vmemcache&lt;/strong> which we have
&lt;a href="https://pmem.io/blog/2019/05/libvmemcache-buffer-based-lru-cache">recently described&lt;/a>
performs close to optimum when either all keys are approximately equally
likely to be queried, or when all key:value pairs fit completely into the
fastest form of memory you are willing to use. But, in many workloads, some
keys are “hot” and queried over and over again, while the rest, “cold”, may
comfortably reside on slower medium. This calls for multiple linked instances
of &lt;strong>vmemcache&lt;/strong>, each residing in a different tier.&lt;/p></description></item><item><title>libvmemcache - buffer-based LRU cache</title><link>https://pmem.io/blog/2019/05/libvmemcache-buffer-based-lru-cache/</link><pubDate>Tue, 07 May 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/05/libvmemcache-buffer-based-lru-cache/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>&lt;strong>libvmemcache&lt;/strong> is a volatile key-value store optimized for operating on
NVDIMM based space. However, it can work with any filesystem whether it is
stored in memory (tmpfs) or on any storage device. Consequently, libvmemcache
will be significantly less performant if it is stored on the storage device
other than NVDIMMs.&lt;/p>
&lt;p>&lt;strong>libvmemcache&lt;/strong> is an embeddable and lightweight in-memory caching solution.
It is designed to fully take advantage of large capacity memory,
such as persistent memory with DAX through memory mapping in an efficient
and scalable way.&lt;/p></description></item><item><title>C++ persistent containers - vector</title><link>https://pmem.io/blog/2019/02/c-persistent-containers-vector/</link><pubDate>Wed, 20 Feb 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/02/c-persistent-containers-vector/</guid><description>&lt;h6 id="note-pmemobjvectorltgtcpp_vector-is-no-longer-experimental-the-rest-of-the-information-in-this-blog-post-is-still-accurate">[Note: &lt;a href="https://pmem.io/libpmemobj-cpp/master/doxygen/classpmem_1_1obj_1_1vector.html" title="pmem::obj:vector">pmem::obj::vector&amp;lt;&amp;gt;&lt;/a> is no longer experimental. The rest of the information in this blog post is still accurate.]&lt;/h6>
&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>The main idea behind pmem containers is to fully exploit persistent memory potential
by designing optimized on-media layouts and algorithms for persistent memory programming.
On November, we published a &lt;a href="https://pmem.io/blog/2018/11/c-persistent-containers/" title="blog post">blog post&lt;/a> about pmem containers.
If you haven’t read it yet, I encourage you to do that now.&lt;/p>
&lt;p>We have recently added &lt;a href="https://pmem.io/libpmemobj-cpp/master/doxygen/classpmem_1_1obj_1_1vector.html" title="pmem::obj:vector">pmem::obj:vector&lt;/a> container to
libpmemobj-cpp library. This container is currently placed in &lt;code>experimental&lt;/code> namespace
and folder - this means that both API and layout may change. It provides API similar
to &lt;code>std::vector&lt;/code> from C++11 but guarantees full exception safety via commit or
rollback semantics and allocates data in persistent memory.&lt;/p></description></item><item><title>Pmreorder basics</title><link>https://pmem.io/blog/2019/02/pmreorder-basics/</link><pubDate>Mon, 04 Feb 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/02/pmreorder-basics/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>It&amp;rsquo;s good practice to run persistent memory application under pmemcheck -
a tool which is described &lt;a href="https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-1-basics">here&lt;/a> and &lt;a href="https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-2-transactions">here&lt;/a>.&lt;/p>
&lt;p>In this post, we are going to learn about another tool for persistence
correctness checking. As you might already know if you&amp;rsquo;ve read posts linked
above, pmemcheck verifies if all stores are made persistent in a proper manner.
Our new tool, pmreorder, extends this functionality. It traverses the
sequences of stores between flush-fence barriers made by the application,
and then replays these memory operations many times in different combinations,
to simulate the various possible ways the stores to the NVDIMM could be ordered
by the system.&lt;/p></description></item><item><title>Pool conversion tool</title><link>https://pmem.io/blog/2019/02/pool-conversion-tool/</link><pubDate>Fri, 01 Feb 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/02/pool-conversion-tool/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>When we published the first PMDK stable release, we committed to maintaining
stable on-media layout. This means that all future PMDK
changes have to be backward compatible. Unfortunately, we weren&amp;rsquo;t successful
in adhering to the strict requirements which would be needed to maintain
compatibility, mostly because we made changes whose benefit far outweighed
the costs. For this reason, we created the &lt;code>pmempool convert&lt;/code> command. This tool was used to convert
pools which were created with old PMDK versions to the newer on-media layout.
In 1.5 release this functionality was refactored and moved to a separate tool
called &lt;a href="https://pmem.io/pmdk-convert/manpages/v1.5/pmdk-convert.1.html">&lt;strong>pmdk-convert&lt;/strong>&lt;/a>.&lt;/p></description></item><item><title>Extended memcpy in PMDK 1.5</title><link>https://pmem.io/blog/2019/01/extended-memcpy-in-pmdk-1.5/</link><pubDate>Tue, 22 Jan 2019 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2019/01/extended-memcpy-in-pmdk-1.5/</guid><description>&lt;p>In PMDK 1.5 we added new APIs for bulk persistent memory modifications.
In short, we did this to:&lt;/p>
&lt;ul>
&lt;li>give applications the ability to perform low-level performance optimizations&lt;/li>
&lt;li>clean up the naming scheme&lt;/li>
&lt;/ul>
&lt;p>In order to understand what exactly and why we did that, let&amp;rsquo;s review the old
API. In PMDK 1.4 we had these functions:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memmove_persist&lt;/span>(&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>src, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memcpy_persist&lt;/span> (&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>src, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memset_persist&lt;/span> (&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">int&lt;/span> c, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memmove_nodrain&lt;/span>(&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>src, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memcpy_nodrain&lt;/span> (&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>src, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmem_memset_nodrain&lt;/span> (&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">int&lt;/span> c, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmemobj_memcpy_persist&lt;/span>(PMEMobjpool &lt;span style="color:#f92672">*&lt;/span>pop, &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>src, size_t len);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">pmemobj_memset_persist&lt;/span>(PMEMobjpool &lt;span style="color:#f92672">*&lt;/span>pop, &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#f92672">*&lt;/span>pmemdest, &lt;span style="color:#66d9ef">int&lt;/span> c, size_t len);
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>As you can see, there are two variants of each API - one with &lt;code>_persist&lt;/code> and
another one with &lt;code>_nodrain&lt;/code> suffix. Both variants modify pmemdest argument
just as their libc&amp;rsquo;s equivalent would, but they also make sure that the copied
data are flushed. The only difference is that the &lt;code>_persist&lt;/code> variants also
wait for the flush to finish. As I mentioned earlier, there&amp;rsquo;s one unfortunate
aspect of this naming - it doesn&amp;rsquo;t follow the scheme used by other libpmem
functions, where &lt;code>pmem_flush&lt;/code> flushes the data, &lt;code>pmem_drain&lt;/code> waits for all
flushes to finish and &lt;code>pmem_persist&lt;/code> does both. In line with this scheme,
&lt;code>_nodrain&lt;/code> functions should have used &lt;code>_flush&lt;/code> suffix.&lt;/p></description></item><item><title>Pool features</title><link>https://pmem.io/blog/2018/12/pool-features/</link><pubDate>Wed, 05 Dec 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/12/pool-features/</guid><description>&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>Since the very first release, PMDK pools had internal feature flags. They were
mostly a hidden implementation detail. The more observant users might have
noticed pool features listing in &lt;a href="https://pmem.io/pmdk/manpages/linux/master/pmempool/pmempool-info.1/">pmempool info&lt;/a> output,
but that&amp;rsquo;s about it.&lt;/p>
&lt;p>&lt;a href="https://pmem.io/blog/2018/10/new-release-of-pmdk">Release 1.5&lt;/a> introduced a set of new feature flags.
And since it&amp;rsquo;s imperative that system administrators have the ability to manage
enabled features, we&amp;rsquo;ve added functionality that helps with that:&lt;/p>
&lt;ul>
&lt;li>&lt;code>pmempool&lt;/code> tool &lt;a href="https://pmem.io/pmdk/manpages/linux/master/pmempool/pmempool-feature.1/">commands for managing features&lt;/a>&lt;/li>
&lt;li>&lt;em>libpmempool&lt;/em> &lt;a href="https://pmem.io/pmdk/manpages/linux/master/libpmempool/pmempool_feature_query.3/">API for managing features&lt;/a>&lt;/li>
&lt;li>CTL namespace for
&lt;a href="https://pmem.io/blog/2018/12/pool-features/#enabling-feature-at-creation-time">setting a &lt;code>SHUTDOWN_STATE&lt;/code> initial value&lt;/a>&lt;/li>
&lt;/ul>
&lt;h1 id="taxonomy-of-pool-features">Taxonomy of pool features&lt;/h1>
&lt;p>Each of the toggleable features can be disabled or enabled for the given pool
and the support for these features might vary depending on the library version.
All features are divided into two groups:&lt;/p></description></item><item><title>Bad blocks</title><link>https://pmem.io/blog/2018/11/bad-blocks/</link><pubDate>Mon, 26 Nov 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/11/bad-blocks/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Over time, storage devices can acquire uncorrectable media errors often called
&amp;ldquo;bad blocks&amp;rdquo;. A bad block is a part of a storage media that is either
inaccessible or unwritable due to a permanent physical damage.
In case of memory mapped I/O, if a process tries to access (read or write)
the corrupted block, it will be terminated by the SIGBUS signal.&lt;/p>
&lt;h3 id="handling-bad-blocks-in-pmdk-libraries">Handling bad blocks in PMDK libraries&lt;/h3>
&lt;p>PMDK libraries can handle bad blocks if the &lt;code>CHECK_BAD_BLOCKS&lt;/code> compat feature
is turned on. Currently (PMDK v1.5) it is disabled by default
because it requires super user privileges. It can be turned on using
&lt;a href="https://pmem.io/blog/2018/11/bad-blocks/#pmempool-feature">pmempool-feature&lt;/a>.&lt;/p></description></item><item><title>C++ persistent containers</title><link>https://pmem.io/blog/2018/11/c-persistent-containers/</link><pubDate>Tue, 20 Nov 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/11/c-persistent-containers/</guid><description>&lt;h3 id="pmem-containers">PMEM containers&lt;/h3>
&lt;p>Our goal for the libpmemobj C++ bindings is to create a friendly and less
error prone API for persistent memory programming. Even with persistent memory
pool allocators, convenient interface for creating and managing transactions,
auto-snapshotting class templates and smart persistent pointers, designing an
application with persistent memory usage may still prove challenging without
a plethora of niceties that the C++ programmers are used to.&lt;/p>
&lt;p>The natural step forward to make persistent programming easier, is to provide
programmers with efficient and useful containers.&lt;/p></description></item><item><title>C++ persistent containers - array</title><link>https://pmem.io/blog/2018/11/c-persistent-containers-array/</link><pubDate>Fri, 02 Nov 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/11/c-persistent-containers-array/</guid><description>&lt;h6 id="note-pmemobjarrayltgtcpp_array-is-no-longer-experimental-the-rest-of-the-information-in-this-blog-post-is-still-accurate">[Note: &lt;a href="https://pmem.io/libpmemobj-cpp/master/doxygen/structpmem_1_1obj_1_1array.html" title="pmem::obj::array">pmem::obj::array&amp;lt;&amp;gt;&lt;/a> is no longer experimental. The rest of the information in this blog post is still accurate.]&lt;/h6>
&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Until now, our C++ bindings were missing one important component - persistent
containers. In 1.5 release we have introduced the first one - &lt;a href="https://pmem.io/libpmemobj-cpp/master/doxygen/structpmem_1_1obj_1_1array.html" title="pmem::obj::array">pmem::obj::array&lt;/a>.
This container is currently placed in &lt;code>experimental&lt;/code> namespace and folder (this means
that both API and layout can change). It has almost the same functionality as &lt;code>std::array&lt;/code>
from C++11 but takes care of adding elements to a transaction. Once experimental status
will be dropped, it will also guarantee a stable in-memory layout (it will be the same for all compilers).
API for &lt;code>pmem::obj::array&lt;/code> and &lt;code>std::array&lt;/code> is the same, except for the following:&lt;/p></description></item><item><title>New release of PMDK</title><link>https://pmem.io/blog/2018/10/new-release-of-pmdk/</link><pubDate>Mon, 22 Oct 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/10/new-release-of-pmdk/</guid><description>&lt;p>We&amp;rsquo;ve been very quiet on this blog as of late, mostly because of the amount of
work that we needed to put into our very ambitiously planned 1.5 release. But
we&amp;rsquo;ve made it, and there&amp;rsquo;s finally time to get back to discussing the technical
minutiae of our work. In this post, we will go over the major library changes
that have been introduced in 1.5.&lt;/p>
&lt;h1 id="release-planning-in-the-open">Release planning in the open&lt;/h1>
&lt;p>But first, I&amp;rsquo;d like to highlight a change to our release planning process.
Instead of using a proprietary walled-off tool, we are slowly moving towards
doing our features planning entirely in the open, directly on GitHub. It&amp;rsquo;s not
all the way there yet, but the &lt;a href="https://github.com/pmem/issues/issues/869">1.5&lt;/a>
release, and the upcoming &lt;a href="https://github.com/pmem/issues/issues/932">one&lt;/a>,
are already using this new open process. When you enter one of the releases,
you will see that most of the planned features have their pages where they can
be discussed.&lt;/p></description></item><item><title>Running FIO with pmem engines</title><link>https://pmem.io/blog/2018/06/running-fio-with-pmem-engines/</link><pubDate>Mon, 25 Jun 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/06/running-fio-with-pmem-engines/</guid><description>&lt;p>When we, the PMDK team, want to check performance of our library, either to see
if there was any regression or if our tweaks did a good job, we run benchmarks.
One of them is FIO. It helps us simulate synthetic traffic of reads and writes
to a pmem device. In this blog post I will introduce this tool and explain how
we commonly use it.&lt;/p>
&lt;h3 id="preparing-the-environment">Preparing the environment&lt;/h3>
&lt;p>For starters, links to needed software:&lt;/p></description></item><item><title>Using Persistent Memory Devices with the Linux Device Mapper</title><link>https://pmem.io/blog/2018/05/using-persistent-memory-devices-with-the-linux-device-mapper/</link><pubDate>Tue, 15 May 2018 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2018/05/using-persistent-memory-devices-with-the-linux-device-mapper/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>X86/X64 systems do not typically interleave Persistent Memory Devices (also referred to as &amp;lsquo;modules&amp;rsquo; or &amp;lsquo;DIMMs&amp;rsquo;) across sockets, so a two-socket system will have two separate interleave sets.  To use these interleave sets as a single device requires using a software device mapper or volume manager.&lt;/p>
&lt;p>This article focuses on using the &amp;lsquo;striped&amp;rsquo; (&lt;strong>dm-stripe&lt;/strong>) and &amp;rsquo;linear&amp;rsquo; (&lt;strong>dm-linear&lt;/strong>) target drivers with persistent memory devices to create virtual devices on which direct access (DAX) enabled filesystems can be created. Both XFS and EXT4 have native DAX support.&lt;/p></description></item><item><title>Benchmarking with different storage engines using pmemkv</title><link>https://pmem.io/blog/2017/12/benchmarking-with-different-storage-engines-using-pmemkv/</link><pubDate>Wed, 27 Dec 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/12/benchmarking-with-different-storage-engines-using-pmemkv/</guid><description>&lt;p>We&amp;rsquo;re closing out 2017 with two big improvements to pmemkv: support for multiple storage engines,
and an improved benchmarking utility based on db_bench. These changes set the stage for some
interesting experiments to come next year, as we continue to add new features and tune performance
of pmemkv and its utilities and bindings.&lt;/p>
&lt;h3 id="multiple-storage-engines">Multiple storage engines&lt;/h3>
&lt;p>A new virtual interface (&lt;code>KVEngine&lt;/code>) was recently introduced that allows &lt;code>pmemkv&lt;/code> to provide
multiple storage engine implementations, without changes to utilities or language bindings
or applications using the &lt;code>pmemkv&lt;/code> API.&lt;/p></description></item><item><title>Announcing the Persistent Memory Development Kit</title><link>https://pmem.io/blog/2017/12/announcing-the-persistent-memory-development-kit/</link><pubDate>Mon, 11 Dec 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/12/announcing-the-persistent-memory-development-kit/</guid><description>&lt;p>This is to announce a name change: The NVML project is now known as
&lt;a href="https://pmem.io/pmdk/">&lt;strong>PMDK&lt;/strong>&lt;/a>, the Persistent Memory Development Kit.&lt;/p>
&lt;h4 id="why-the-name-change">Why the name change?&lt;/h4>
&lt;p>The old name, NVML, made it sound like the project produced a single library
that applied to Non-Volatile Memory. In reality, the project currently
supports &lt;strong>ten libraries&lt;/strong>, targeted at various use cases for persistent
memory, along with language support for
&lt;strong>C&lt;/strong>, &lt;strong>C++&lt;/strong>, &lt;strong>Java&lt;/strong>, and &lt;strong>Python&lt;/strong>,
tools like the &lt;strong>pmemcheck&lt;/strong>
plug-in for valgrind, and an increasing body of documentation, code examples,
tutorials, and &lt;a href="https://pmem.io/blog/">blog entries&lt;/a>. The libraries are tuned and validated
to &lt;strong>production quality&lt;/strong> and issued with a license that allows their use in
both open- and closed-source products. And the project continues to grow as we
learn about new use cases. So the term &lt;em>Development Kit&lt;/em> seems much more
appropriate. The new name, &lt;a href="https://pmem.io/pmdk/">PMDK&lt;/a>, also follows the pattern of similar
development kits like the Data Plane Development Kit (&lt;a href="https://dpdk.org">DPDK&lt;/a>)
and the Storage Performance Development Kit (&lt;a href="https://spdk.io">SPDK&lt;/a>).&lt;/p></description></item><item><title>Progress Report Q3 2017</title><link>https://pmem.io/blog/2017/10/progress-report-q3-2017/</link><pubDate>Thu, 05 Oct 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/10/progress-report-q3-2017/</guid><description>&lt;p>The last quarter was rather&amp;hellip; peaceful. But nevertheless there were a few
noteworthy things.&lt;/p>
&lt;h3 id="freebsd--arm">FreeBSD &amp;amp; ARM&lt;/h3>
&lt;p>We always asserted that our library is multi-platform and hardware agnostic&amp;hellip;
as long as your platform is a recent distribution of Linux (or Windows)
on x86 hardware :)&lt;/p>
&lt;p>Two things happened that intend to change the current status quo:&lt;/p>
&lt;ul>
&lt;li>There&amp;rsquo;s an active and ongoing effort of porting the linux-specific
parts of the library to FreeBSD, mostly led by &lt;a href="https://github.com/gaweinbergi">@gaweinbergi&lt;/a>.
Our code is naturally very linux centric due to being developed
alongside the kernel support for NVDIMMs, and there are quite a few
hurdles to overcome, but everything seems to be going along quite nicely.&lt;/li>
&lt;li>Patch that ports the low-level library (libpmem) to ARM has been
submitted to our repository by &lt;a href="https://github.com/vvenkates27">@vvenkates27&lt;/a>.
This is also a place where there&amp;rsquo;s a lot of platform specific code due to
the novelty of the topic and the fact that the library implementation requires a
hefty amount of ISA specific intrinsics.&lt;/li>
&lt;/ul>
&lt;h3 id="allocation-classes-merged">Allocation classes merged&lt;/h3>
&lt;p>I&amp;rsquo;ve talked about this previously, so I won&amp;rsquo;t repeat myself here, but the
allocation classes were finally merged last quarter.&lt;/p></description></item><item><title>Using Standard Library Containers with Persistent Memory</title><link>https://pmem.io/blog/2017/07/using-standard-library-containers-with-persistent-memory/</link><pubDate>Mon, 10 Jul 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/07/using-standard-library-containers-with-persistent-memory/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>Somewhere along the road, when we were doing the C++ bindings for libpmemobj, we found the need for some kind of containers. We were faced with two viable solutions: write everything from scratch or adapt an existing implementation. The obvious choice was NOT to implement from scratch. We would have to implement at least the basic containers from the C++ standard: vector, list, set, map and their multi- companions. That would be a lot of work, not to mention the testing and maintenance effort. I&amp;rsquo;d say it would be the last resort, should all of our other options fail.&lt;/p></description></item><item><title>Progress Report Q2 2017</title><link>https://pmem.io/blog/2017/07/progress-report-q2-2017/</link><pubDate>Tue, 04 Jul 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/07/progress-report-q2-2017/</guid><description>&lt;p>It&amp;rsquo;s summer already (at least in my hemisphere) ! :) And it&amp;rsquo;s time for the next
progress report.&lt;/p>
&lt;h3 id="control-interface">Control interface&lt;/h3>
&lt;p>After a very long in the oven, we&amp;rsquo;ve finally finalized and merged the CTL API
which allows for introspection and modification of the internal state of the
library.&lt;/p>
&lt;p>This feature has been shaped after the &lt;code>mallctl()&lt;/code> available in jemalloc.&lt;/p>
&lt;p>The way it works is very simple. Developer defines a function-like entry
point, decides whether or not the entry point allows for reading, writing
or both, and finally specifies the argument type. All of this happens in a very
streamlined fashion.&lt;/p></description></item><item><title>Apache Kudu Persistent Memory Enabled Block Cache</title><link>https://pmem.io/blog/2017/04/apache-kudu-persistent-memory-enabled-block-cache/</link><pubDate>Mon, 03 Apr 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/04/apache-kudu-persistent-memory-enabled-block-cache/</guid><description>&lt;h1 id="using-nvm-libraries-to-add-persistent-memory-support-to-apache-kudu-block-cache">Using NVM Libraries To Add Persistent Memory Support to Apache Kudu Block Cache&lt;/h1>
&lt;p>An early project done with the NVM libraries was adding persistent memory support, both volatile and persistent mode, into the Apache Kudu storage engine block cache. This project required modification of existing code.&lt;/p>
&lt;p>Apache Kudu:
&lt;a href="https://github.com/apache/kudu">https://github.com/apache/kudu&lt;/a>&lt;/p>
&lt;p>My repository with the modified code:
&lt;a href="https://github.com/sarahjelinek/kudu">https://github.com/sarahjelinek/kudu&lt;/a>, branch: sarah_kudu_pmem&lt;/p>
&lt;p>The volatile mode support for persistent memory has been fully integrated into the Kudu source base. The persistent mode support is not integrated but is ready, has been reviewed and is waiting for official integration.&lt;/p></description></item><item><title>Progress Report Q1 2017</title><link>https://pmem.io/blog/2017/03/progress-report-q1-2017/</link><pubDate>Wed, 29 Mar 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/03/progress-report-q1-2017/</guid><description>&lt;p>It&amp;rsquo;s been three months already since the last time I wrote something ;) Time
really flies by quickly when you are doing interesting stuff.&lt;/p>
&lt;p>We&amp;rsquo;ve been very busy with lots of improvements to the library as well as A LOT
of tiny fixes: over the last three months the team eliminated virtually every
bug found by various static analysis tools and valgrind.&lt;/p>
&lt;p>But no-one wants to hear about that, so here&amp;rsquo;s the meaty stuff:&lt;/p></description></item><item><title>Zero-copy leaf splits in pmemkv</title><link>https://pmem.io/blog/2017/03/zero-copy-leaf-splits-in-pmemkv/</link><pubDate>Thu, 09 Mar 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/03/zero-copy-leaf-splits-in-pmemkv/</guid><description>&lt;p>In a B+ tree, splitting a full leaf into two leaves is one of its
slowest operations, but
&lt;a href="https://github.com/pmem/pmemkv">pmemkv&lt;/a>
optimizes this using a zero-copy strategy. Rather then copying any
key/value data between full and new leaf,
&lt;a href="https://github.com/pmem/pmemkv">pmemkv&lt;/a>
splits leaves by swapping persistent structures in place.
This minimizes write amplification and increases performance
compared to copying, especially for larger key/value sizes.&lt;/p>
&lt;p>The diagram below illustrates a persistent leaf being split. A &amp;lsquo;slot&amp;rsquo;
is the term used in
&lt;a href="https://github.com/pmem/pmemkv">pmemkv&lt;/a>
for the grouping of a key, the Pearson hash for the key, and the
value for the key. During the split, slots having keys that sort
below or equal to the split key are untouched, but those slots in
the new leaf are marked unused. Slots where keys sort above the
split key have to be relocated to the new leaf, and those original
slots in the full leaf are marked unused.&lt;/p></description></item><item><title>Introducing pmemkv</title><link>https://pmem.io/blog/2017/02/introducing-pmemkv/</link><pubDate>Tue, 21 Feb 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/02/introducing-pmemkv/</guid><description>&lt;p>We&amp;rsquo;ve blogged before about
&lt;a href="https://pmem.io/blog/2015/07/transactional-key-value-store-using-libpmemobj-diy">building&lt;/a> and
&lt;a href="https://pmem.io/blog/2015/09/kv-store-improved-measured">optimizing&lt;/a>
key-value stores for persistent memory, and we&amp;rsquo;re excited to
put these ideas to the test in a more formal way.&lt;/p>
&lt;p>Our new &lt;strong>&lt;a href="https://github.com/pmem/pmemkv">pmemkv&lt;/a>&lt;/strong> project is
an open-source key-value store that is optimized
for read-heavy workloads on persistent memory.
Compared with key-value stores based on the
&lt;a href="https://en.wikipedia.org/wiki/Log-structured_merge-tree">LSM algorithm&lt;/a>,
pmemkv offers higher read performance and lower write amplification.
But our intent is not to deter use of LSM, only to expand the choices
developers and architects have for aligning workloads to backing stores.&lt;/p></description></item><item><title>What's coming in libpmemobj</title><link>https://pmem.io/blog/2017/01/whats-coming-in-libpmemobj/</link><pubDate>Wed, 25 Jan 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/01/whats-coming-in-libpmemobj/</guid><description>&lt;p>In my last post I&amp;rsquo;ve made a promise to share our plans for the near future. So
here it is: 4 ideas that we are planning to ship with the upcoming version
of libpmemobj.&lt;/p>
&lt;p>Please note that most of our plans related to libpmemobj are available on
our
&lt;a href="https://github.com/pmem/issues/issues?q=is%3Aopen&amp;#43;is%3Aissue&amp;#43;label%3A%22Type%3A&amp;#43;Feature%22">github issues&lt;/a>
page with the &amp;ldquo;Feature&amp;rdquo; label. Feel free to join the discussion!&lt;/p>
&lt;h3 id="reserveinitializepublish-work-flow">Reserve/Initialize/Publish work-flow&lt;/h3>
&lt;p>Many of persistent memory programming models proposed by researchers [1, 2]
provide a different transactional semantics compared to libpmemobj. In the
simplest terms, they allow the programmer to reserve and initialize memory
anywhere in the code and publish that object inside of a transaction.&lt;/p></description></item><item><title>Modeling strings with libpmemobj C++ bindings</title><link>https://pmem.io/blog/2017/01/modeling-strings-with-libpmemobj-c-bindings/</link><pubDate>Mon, 23 Jan 2017 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2017/01/modeling-strings-with-libpmemobj-c-bindings/</guid><description>&lt;p>C++ developers using libpmemobj have more than one option for modeling strings,
depending on the size of the strings and whether they are fixed or varying
in length. In this post we&amp;rsquo;ll review the representations that work,
known variations to avoid, and finally present a persistent string
class that implements these best practices.&lt;/p>
&lt;h4 id="avoid-wrapping-fixed-size-arrays">Avoid wrapping fixed-size arrays&lt;/h4>
&lt;p>You might expect (like I did at first!) that &lt;code>p&amp;lt;char[size]&amp;gt;&lt;/code> is a proper way
to simply model a fixed-size string, but actually this is not correct.
The &lt;code>p&amp;lt;&amp;gt;&lt;/code> template does not implement the subscript &lt;code>operator[]&lt;/code> and so
&lt;code>p&amp;lt;char[size]&amp;gt;&lt;/code> won&amp;rsquo;t even compile.&lt;/p></description></item><item><title>PMDK for Windows</title><link>https://pmem.io/blog/2016/12/pmdk-for-windows/</link><pubDate>Wed, 21 Dec 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/12/pmdk-for-windows/</guid><description>&lt;p>Throughout 2016 a team of engineers from Microsoft, Intel, HPE and HPI have
been working to port the PMDK project to Windows and we are happy to
announce that &lt;a href="https://github.com/pmem/pmdk/releases/tag/1.2%2Bwtp1">Technical Preview release&lt;/a>
is now available!&lt;/p>
&lt;p>Our main goal in porting the library was to make it as easy as
possible for developers to use the library in both Linux and Windows
environments. To meet this goal, we focused on these elements as we
undertook the effort:&lt;/p></description></item><item><title>libpmemobj - a year in review</title><link>https://pmem.io/blog/2016/12/libpmemobj-a-year-in-review/</link><pubDate>Tue, 20 Dec 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/12/libpmemobj-a-year-in-review/</guid><description>&lt;p>It&amp;rsquo;s been a while since the last post on our blog, but we&amp;rsquo;ve been busy with the
recently released 1.2 version of the library. It comes packed with improvements
all throughout the code base and it also brings a handful of new features that
we hope will end up being useful.&lt;/p>
&lt;p>With the year coming to an end, it&amp;rsquo;s a good time to look back and discuss the
things we&amp;rsquo;ve learned and accomplished. While the 2015 was spent mostly on
designing and implementing the core of the library, with code being furiously
written in heavy volumes, this year was much calmer and naturally focused
on refinements and iterative improvements. The experience we&amp;rsquo;ve gathered during
the creation of the library was invaluable and allowed us to think about the
problems we are tackling from a different, broader, perspective. This is
reflected in the things we are focused on and ship with new versions of the library.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (epilogue) - converting existing applications</title><link>https://pmem.io/blog/2016/06/c-bindings-for-libpmemobj-epilogue-converting-existing-applications/</link><pubDate>Thu, 02 Jun 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/06/c-bindings-for-libpmemobj-epilogue-converting-existing-applications/</guid><description>&lt;p>During the development of the C++ bindings, we wrote a couple of examples and
even more tests. But these are new applications written from scratch to
understand persistence. While this approach is OK for newly developed apps,
there is a lot of existing code out there that is not designed for persistent
memory. It would be a real shame, if the existing solutions couldn&amp;rsquo;t benefit
from the existence of persistent memory because of the amount of work needed
to redesign and change them. This was one of the main pain points that we wanted
to address with the C++ bindings. We tried to make them as seamless to use and
as easily introducible to existing software as possible. In this blog post I
will show you exactly how much work is necessary to change an implementation
of a ctree from oblivious to fully persistent memory aware.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 7) - synchronization primitives</title><link>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-7-synchronization-primitives/</link><pubDate>Tue, 31 May 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-7-synchronization-primitives/</guid><description>&lt;p>To finish off the C++ bindings to libpmemobj blog marathon, I will introduce to
you the synchronization mechanisms we implemented. They are mostly C++11-like
implementations of different kinds of mutexes and the condition variable. They
satisfy their respective concepts (Mutex, SharedMutex and so on), the difference
is that they are based on the persistent memory resident synchronization
primitives provided by libpmemobj.&lt;/p>
&lt;h3 id="mutex">Mutex&lt;/h3>
&lt;p>The &lt;code>pmem::obj::mutex&lt;/code> class satisfies the requirements of the &lt;em>Mutex&lt;/em> and
&lt;em>StandardLayoutType&lt;/em> concepts. The usage of this class should be really
straightforward for anyone who has ever used the &lt;code>std::mutex&lt;/code>. The only
difference is that the &lt;code>pmem::obj::mutex&lt;/code> has to be placed in persistent memory,
within a libpmemobj pool. This is because the implementation needs to be able to
reset the mutex the next time the pool is opened after a power failure/crash.
In persistent memory, the mutex would not be reinitialized automatically in
such case.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 6) - transactions</title><link>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-6-transactions/</link><pubDate>Wed, 25 May 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-6-transactions/</guid><description>&lt;p>As I mentioned in my previous blog &lt;a href="https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-5-make_persistent" title="make_persistent">post&lt;/a>, transactions are the heart
of libpmemobj. That is why we had to take utmost care while designing their
C++ versions, so that they are as easy to use as possible. There are, however, a
couple of compromises we had to make due to the inadequacies of the C++11
standard. That is why we encourage using the lambda, until the C++17 standard is
more widely implemented. Frankly, even after C++17, the lambda transactions are
more user friendly.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 5) - make_persistent</title><link>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-5-make_persistent/</link><pubDate>Thu, 19 May 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-5-make_persistent/</guid><description>&lt;p>One of the most important features of the C++ bindings to libpmemobj is the
&lt;code>persistent_ptr&lt;/code> smart pointer template. While using it is fairly
straightforward, the allocation and object construction with the use of the C
API is hard to get right. So like it&amp;rsquo;s C++ standard&amp;rsquo;s counterparts, it needed an
allocation mechanism with appropriate object construction. This is exactly what
this post will try to explain.&lt;/p>
&lt;h3 id="transactional-allocations">Transactional allocations&lt;/h3>
&lt;p>Probably the most common usage of the allocating functions is within pmemobj
transactions. The easiest way to allocate an object into a &lt;code>persistent_ptr&lt;/code> is
by doing the following:&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 4) - pool handle wrapper</title><link>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-4-pool-handle-wrapper/</link><pubDate>Tue, 10 May 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/05/c-bindings-for-libpmemobj-part-4-pool-handle-wrapper/</guid><description>&lt;p>One of the necessary steps in developing the C++ libpmemobj bindings was the
introduction of an abstraction of the C pool handle. We decided to do a very
simple hierarchy where the &lt;code>pool&lt;/code> template inherits from a generic &lt;code>pool_base&lt;/code>.
This was necessary to be able to have functions/methods which do not depend on
the pool&amp;rsquo;s template argument. Please note that this makes both of these handles
&lt;strong>impossible&lt;/strong> to keep in persistent memory, due to the presence of a vtable.
It wouldn&amp;rsquo;t make much sense either way, because the pool handle is &lt;em>runtime&lt;/em>
and not &lt;em>persistent&lt;/em> data.&lt;/p></description></item><item><title>Persistent allocator design - fragmentation</title><link>https://pmem.io/blog/2016/02/persistent-allocator-design-fragmentation/</link><pubDate>Thu, 25 Feb 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/02/persistent-allocator-design-fragmentation/</guid><description>&lt;p>Implementing a memory allocator is a balance between numerous properties with
the two most important being time and space constraints. Making the malloc/free
routines reasonably fast is a must for the implementation to be considered
usable at all. The algorithm also mustn&amp;rsquo;t waste excessive amounts of memory.&lt;/p>
&lt;p>During development of the library we quickly realized that the performance
characteristics will be dominated by the number of cache line flushes that will
be required to perform operations in a fail-safe atomic way. In other words,
how many times does the on-medium memory layout transitions from one consistent
state to another. This lead us to measuring performance of low-level pmalloc in
a function of &lt;code>pmem_persist&lt;/code> calls.
At the time of writing, fail-safe atomic memory allocation in our library
requires on average 3 cache line flushes.&lt;/p></description></item><item><title>How to emulate Persistent Memory</title><link>https://pmem.io/blog/2016/02/how-to-emulate-persistent-memory/</link><pubDate>Mon, 22 Feb 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/02/how-to-emulate-persistent-memory/</guid><description>&lt;p>Data allocated with PMDK is put to the virtual memory address space, and concrete ranges are relying on result of &lt;code>mmap(2)&lt;/code> operation performed on the user defined files.
Such files can exist on any storage media, however data consistency assurance embedded within PMDK requires frequent synchronisation of data that is being modified.
Depending on platform capabilities, and underlying device where the files are, a different set of commands is used to facilitate synchronisation.
It might be &lt;code>msync(2)&lt;/code> for the regular hard drives, or combination of cache flushing instructions followed by memory fence instruction for the real persistent memory.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 0)</title><link>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-0/</link><pubDate>Tue, 12 Jan 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-0/</guid><description>&lt;p>Our goal for the C pmemobj library was to make a fully featured implementation
of persistent memory programming model without modifying the compiler. It&amp;rsquo;s
meant for authors of very low-level system software and language creators.
It&amp;rsquo;s not particularly pretty nor easy to use. The amount of macros, as well as
the trickery inside them, might &amp;lsquo;amaze&amp;rsquo; even the biggest preprocessor fans ;)&lt;/p>
&lt;p>The natural next step is to leverage the high-level languages features to
create a more friendly, less error prone and generally nicer API.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 1) - pmem resident variables</title><link>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-1-pmem-resident-variables/</link><pubDate>Tue, 12 Jan 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-1-pmem-resident-variables/</guid><description>&lt;p>One of the biggest hurdles and error prone things about our C API is that the
user has to manually keep track of modifications to the persistent memory resident
variables while in a transaction. A special semi-transparent template property
class has been implemented to automatically add variable modifications to the
transaction undo log.&lt;/p>
&lt;h3 id="pmemobjp">pmem::obj::p&lt;/h3>
&lt;p>Let&amp;rsquo;s start with the vector example from the previous tutorial series. It looked
like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">vector&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> y;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> z;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PMEMoid root &lt;span style="color:#f92672">=&lt;/span> pmemobj_root(pop, &lt;span style="color:#66d9ef">sizeof&lt;/span> (&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">vector&lt;/span>));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">vector&lt;/span> &lt;span style="color:#f92672">*&lt;/span>vectorp &lt;span style="color:#f92672">=&lt;/span> pmemobj_direct(root);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TX_BEGIN(pop) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> pmemobj_tx_add_range(root, &lt;span style="color:#ae81ff">0&lt;/span>, &lt;span style="color:#66d9ef">sizeof&lt;/span> (&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">vector&lt;/span>));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> vectorp&lt;span style="color:#f92672">-&amp;gt;&lt;/span>x &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">5&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> vectorp&lt;span style="color:#f92672">-&amp;gt;&lt;/span>y &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> vectorp&lt;span style="color:#f92672">-&amp;gt;&lt;/span>z &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">15&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} TX_END
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>As you can see, the programmer has to remember to call &lt;code>pmemobj_tx_add_range&lt;/code>
function before any modifications to the memory. In a simple case like this one
it might not be such a big deal, but once the code gets complex it may lead to
some difficult to find consistency issues.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 2) - persistent smart pointer</title><link>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-2-persistent-smart-pointer/</link><pubDate>Tue, 12 Jan 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-2-persistent-smart-pointer/</guid><description>&lt;p>In our C API the programmer has to deal with custom pointers represented by
the PMEMoid structure. Thanks to some macro magic we made it so that those PMEMoids
are somewhat usable. C++ allows us to evolve this concept.&lt;/p>
&lt;h3 id="pmemobjpersistent_ptr">pmem::obj::persistent_ptr&lt;/h3>
&lt;p>Almost everyone who ever touched a C++ code knows the idea behind smart pointers
(for example, &lt;code>std::shared_ptr&lt;/code>). Our persistent pointer works in the same way.
It wraps around a type and provides implementation of &lt;code>operator*&lt;/code>, &lt;code>operator-&amp;gt;&lt;/code>
and &lt;code>operator[]&lt;/code>.&lt;/p></description></item><item><title>C++ bindings for libpmemobj (part 3) - persistent queue example</title><link>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-3-persistent-queue-example/</link><pubDate>Tue, 12 Jan 2016 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2016/01/c-bindings-for-libpmemobj-part-3-persistent-queue-example/</guid><description>&lt;p>The best way to learn to code is usually by implementing an example. We are going
to be creating a linked-list based queue data structure using the the
&lt;code>pmem::obj::p&lt;/code> and &lt;code>pmem::obj::persistent_ptr&lt;/code> classes and libpmemobj C API. But
first, a little bit of CS 101 :)&lt;/p>
&lt;h2 id="linked-list-queue">Linked-list queue&lt;/h2>
&lt;p>Queue is a collection of elements with two important operations:&lt;/p>
&lt;ul>
&lt;li>&lt;code>push&lt;/code> - adds element to the &lt;code>tail&lt;/code> of the structure&lt;/li>
&lt;li>&lt;code>pop&lt;/code> - removes element from the &lt;code>head&lt;/code> of the structure&lt;/li>
&lt;/ul>
&lt;p>This makes the queue a First-In-First-Out (FIFO) data structure.&lt;/p></description></item><item><title>Performance improvements</title><link>https://pmem.io/blog/2015/12/performance-improvements/</link><pubDate>Tue, 15 Dec 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/12/performance-improvements/</guid><description>&lt;p>I would like to inform you about the performance improvements that have been going on in PMDK and libpmemobj in particular. We have not been standing still and we are trying out a couple of ideas on how to make our libraries even faster. Some of the improvements are smaller, some are larger. Some of them have already made it to the master branch and some are just ideas on how to rework the internals of libpmemobj to make it even faster. All measurements were made on a two socket, sixteen core machine.&lt;/p></description></item><item><title>An introduction to replication</title><link>https://pmem.io/blog/2015/11/an-introduction-to-replication/</link><pubDate>Mon, 23 Nov 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/11/an-introduction-to-replication/</guid><description>&lt;p>Replication is a means for raising the reliability of your &lt;em>pmemobj&lt;/em> based applications. You can basically think of it as RAID 1 within &lt;em>PMDK&lt;/em>. What happens is, when you write to your pool using the &lt;code>pmemobj_*&lt;/code> (memcpy, persist, and so on) primitives, it gets copied to your replicas. Yes, you can have more than one replica. In fact you can have as many as you want, but you have to keep in mind the performance penalty.&lt;/p></description></item><item><title>Evaluation of a better object container</title><link>https://pmem.io/blog/2015/10/evaluation-of-a-better-object-container/</link><pubDate>Tue, 20 Oct 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/10/evaluation-of-a-better-object-container/</guid><description>&lt;p>During performance evaluation of our library, I asked myself a following
question:&lt;/p>
&lt;p>Which data structure has computational complexity of &amp;ldquo;insert at end&amp;rdquo; and &amp;ldquo;remove
given element&amp;rdquo; operations no worse than a doubly-linked list, but with a smaller
constant?&lt;/p>
&lt;p>The point of that mental exercise was to come up with a persistent data
structure that could replace doubly-linked list in object stores
(right now a linked lists of every single user-allocated object) and undo logs.&lt;/p></description></item><item><title>pmemobjfs - The simple FUSE based on libpmemobj</title><link>https://pmem.io/blog/2015/09/pmemobjfs-the-simple-fuse-based-on-libpmemobj/</link><pubDate>Tue, 29 Sep 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/09/pmemobjfs-the-simple-fuse-based-on-libpmemobj/</guid><description>&lt;h3 id="how-to-use-it">How to use it&lt;/h3>
&lt;p>The sources of the &lt;strong>pmemobjfs&lt;/strong> file system are available
&lt;a href="https://github.com/pmem/pmdk/tree/master/src/examples/libpmemobj/pmemobjfs">here&lt;/a>. Please refer
to &lt;a href="https://github.com/pmem/pmdk/blob/master/src/examples/libpmemobj/pmemobjfs/README">README&lt;/a>
file for instructions on how to create a file system layout and mount it.&lt;/p>
&lt;p>&lt;strong>NOTE:&lt;/strong> This is just an example implementation of file system in user space using
the &lt;strong>libpmemobj&lt;/strong> library and it is &lt;strong>not&lt;/strong> considered to be &lt;em>production quality&lt;/em>.
&lt;strong>Please do not use this file system to store your data you care about
because it may be lost.&lt;/strong>&lt;/p></description></item><item><title>Challenges of multi-threaded transactions</title><link>https://pmem.io/blog/2015/09/challenges-of-multi-threaded-transactions/</link><pubDate>Wed, 16 Sep 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/09/challenges-of-multi-threaded-transactions/</guid><description>&lt;p>Our library currently does not support threads cooperating (writing) within a
single transaction. It does shift a lot of work from the library onto the user
who now has to think about different parallelization solutions.&lt;/p>
&lt;p>This was a conscious decision with iterative approach to creating the library
in mind. It was far easier to implement the current transaction support strategy
and say that it works with relatively good performance than it would be to
implement multi-threaded transactions straight up and say that they work and
scale linearly with CPUs thrown at them (yea right). The required validation
effort alone would be tremendous.&lt;/p></description></item><item><title>KV-store improved &amp; measured</title><link>https://pmem.io/blog/2015/09/kv-store-improved-measured/</link><pubDate>Thu, 10 Sep 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/09/kv-store-improved-measured/</guid><description>&lt;p>As promised in the
&lt;a href="https://pmem.io/blog/2015/07/transactional-key-value-store-using-libpmemobj-diy/">previous post&lt;/a>
about the kv-store implementation I&amp;rsquo;m back with new results after implementing
the optimizations I devised a month ago. As a bonus I implemented a red-black
tree to have a fair comparison between two data structures that allocate similar
number of nodes.&lt;/p>
&lt;p>tl;dr: I was right about crit-bit :)&lt;/p>
&lt;h3 id="test-platform">Test platform&lt;/h3>
&lt;p>The same server was used to run the benchmarks but with the latest 4.2 kernel
that contains numerous DAX improvements.&lt;/p></description></item><item><title>Transactional key-value store using libpmemobj - DIY</title><link>https://pmem.io/blog/2015/07/transactional-key-value-store-using-libpmemobj-diy/</link><pubDate>Fri, 31 Jul 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/07/transactional-key-value-store-using-libpmemobj-diy/</guid><description>&lt;p>Our library often gets compared to NoSQL databases because it stores things on
storage in unstructured manner. Which is true, but, when you think about it,
the pmemobj library is not technically a database, but can be used to implement
one - like the MySQL storage engine example. In this post I&amp;rsquo;ll describe an
example implementation of transactional kv-store, that has two different
backends, which I&amp;rsquo;ll then compare. To make things more interesting, it&amp;rsquo;s not
going to be your typical kv-store, since the data structure behind it won&amp;rsquo;t
be a hashmap. Instead, I&amp;rsquo;ve selected two different tree algorithms, namely
b-tree and crit-bit tree.&lt;/p></description></item><item><title>An introduction to pmemcheck (part 2) - transactions</title><link>https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-2-transactions/</link><pubDate>Mon, 20 Jul 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-2-transactions/</guid><description>&lt;p>In my previous blog post I described the key features of the new persistent memory analysis tool we created - pmemcheck. You should now be aware of the main pitfalls of persistent memory programming and of ways pmemcheck informs you about possible misuses of PMEM. We should now dive into a more general approach of using persistent memory in a failsafe manner - transactions. This shouldn&amp;rsquo;t be an alien concept for anybody who had anything to do with databases. The idea of transactions in persistent memory is very similar. You enclose a set of operations, which are to be performed as a whole, inside a transaction. The transaction should ensure that on transaction commit you get a durable and consistent state. By durable I mean that all changes will be made persistent and by consistent I mean you will get either the state from before the transaction or after all of the modifications were made. I mentioned databases, because the concept is similar and everybody should be familiar with it, but you have to remember that this is on a slightly different level of abstraction. This is raw access of memory and not database inserts. This of course depends on the implementation of transactions, but it might prove very helpful not to think, that all persistent memory transactions will have ACID properties. Or at least they won&amp;rsquo;t be on a level you expect them to be.&lt;/p></description></item><item><title>An introduction to pmemcheck (part 1) - basics</title><link>https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-1-basics/</link><pubDate>Fri, 17 Jul 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/07/an-introduction-to-pmemcheck-part-1-basics/</guid><description>&lt;p>As you probably noticed from the previous posts, persistent memory programming isn&amp;rsquo;t really that easy. There are a couple of things you have to consider - data consistency being the most important one. The contemporary x86_64 architecture supports at most 8-byte atomic stores. You probably know by now, that by atomic I mean non-torn and not thread-safe. This means that you can be confident that you will not get 4 out of the 8 bytes with the new value and the rest will not be updated. However, there aren&amp;rsquo;t many real-life programs that think in 8 byte chunks of data. Therefore &lt;a href="https://pmem.io/pmdk/" title="Persistent Memory Development Kit">PMDK&lt;/a> resorts to &lt;strong>non-trivial tricks&lt;/strong> to ensure larger portions of memory can be updated in a failsafe manner.&lt;/p></description></item><item><title>An introduction to pmemobj (part 7) - persistent lists</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-7-persistent-lists/</link><pubDate>Fri, 19 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-7-persistent-lists/</guid><description>&lt;p>The pmemobj library provides non-transactional persistent atomic circular doubly-linked lists (or NTPACDLL for short) API with an interface familiar to anyone who have ever included &lt;code>sys/queue.h&lt;/code> header file - it&amp;rsquo;s in fact so similar that I considered not writing this post at all, you can just search the web for &lt;code>CIRCLEQ&lt;/code> example.&lt;/p>
&lt;p>Fun fact: The exact same list code is used internally by libpmemobj in the transaction undo log implementation.&lt;/p></description></item><item><title>An introduction to pmemobj (part 5) - atomic dynamic memory allocation</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-5-atomic-dynamic-memory-allocation/</link><pubDate>Thu, 18 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-5-atomic-dynamic-memory-allocation/</guid><description>&lt;p>In the previous post I talked about using transactions for allocating new objects, which is fine and is the most similar approach to the standard POSIX way. But it does add an overhead of maintaining an undo log of changes. A more optimal memory management can be achieved using the non-transactional atomic API the pmemobj library provides.&lt;/p>
&lt;h3 id="fail-safe-atomic-allocations">Fail-safe atomic allocations&lt;/h3>
&lt;p>This API is &lt;strong>not&lt;/strong> similar to the APIs most programmers are used to when it comes to handling memory. First of all, the functions are either allocating to, or freeing from a pointer. The modification of the destination pointer is done in an atomic way so that it is always valid - it either points to a valid and initialized memory block or an &lt;code>OID_NULL&lt;/code>. The functions/macros also force you to create the objects in a known state - either by zeroing them (&lt;code>POBJ_ZNEW&lt;/code>, &lt;code>POBJ_ZALLOC&lt;/code>), or providing a constructor for you to initialize the pointer (&lt;code>POBJ_NEW&lt;/code>, &lt;code>POBJ_ALLOC&lt;/code>).&lt;/p></description></item><item><title>An introduction to pmemobj (part 6) - threading</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-6-threading/</link><pubDate>Thu, 18 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-6-threading/</guid><description>&lt;p>All of the pmemobj library &lt;strong>functions&lt;/strong> are thread-safe, with following two exceptions: pool management functions (open, close and friends) and &lt;code>pmemobj_root&lt;/code> when providing different sizes in different threads - so as long as you are using this function the way it&amp;rsquo;s meant to be used you don&amp;rsquo;t have to worry about it. As for macros - generally only the FOREACH macros are not thread-safe for obvious reasons.&lt;/p>
&lt;h3 id="synchronization">Synchronization&lt;/h3>
&lt;p>If you need to put a lock inside a structure that resides on persistent memory, our library provides pthread-like API for that purpose. There&amp;rsquo;s no need to initialize those locks or to verify their state. When an application crashes they are all automatically unlocked. As for the reason why something like this is needed, consider following code:&lt;/p></description></item><item><title>An introduction to pmemobj (part 4) - transactional dynamic memory allocation</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-4-transactional-dynamic-memory-allocation/</link><pubDate>Wed, 17 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-4-transactional-dynamic-memory-allocation/</guid><description>&lt;p>This is a topic I intentionally avoided not to introduce too much complexity too fast. The pmemobj library contains an implemented from scratch memory allocator, that was designed with persistent memory in mind. There are two separate APIs: non-transactional and transactional.&lt;/p>
&lt;h3 id="transactional-allocations">Transactional allocations&lt;/h3>
&lt;p>Let&amp;rsquo;s start with a simple snippet of volatile code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">rectangle&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> a;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> b;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">int&lt;/span> &lt;span style="color:#a6e22e">area_calc&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">rectangle&lt;/span> &lt;span style="color:#f92672">*&lt;/span>rect) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> rect&lt;span style="color:#f92672">-&amp;gt;&lt;/span>a &lt;span style="color:#f92672">*&lt;/span> rect&lt;span style="color:#f92672">-&amp;gt;&lt;/span>b;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>...
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">rectangle&lt;/span> &lt;span style="color:#f92672">*&lt;/span>rect &lt;span style="color:#f92672">=&lt;/span> malloc(&lt;span style="color:#66d9ef">sizeof&lt;/span> &lt;span style="color:#f92672">*&lt;/span>rect);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">if&lt;/span> (rect &lt;span style="color:#f92672">==&lt;/span> NULL) &lt;span style="color:#66d9ef">return&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rect&lt;span style="color:#f92672">-&amp;gt;&lt;/span>a &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">5&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rect&lt;span style="color:#f92672">-&amp;gt;&lt;/span>b &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">int&lt;/span> p &lt;span style="color:#f92672">=&lt;/span> area_calc(rect);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">/* busy work */&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>free(rect)&lt;span style="color:#f92672">:&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You should know how to modify this code for persistent memory by now, with two exceptions - &lt;code>malloc&lt;/code> and &lt;code>free&lt;/code>. Let&amp;rsquo;s start by declaring the layout:&lt;/p></description></item><item><title>An introduction to pmemobj (part 3) - types</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-3-types/</link><pubDate>Tue, 16 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-3-types/</guid><description>&lt;p>In all of the previous post the code snippets and examples had persistent pointers (PMEMoid) without any type information - they were simple C structures. Very early in the development of the library we discovered that using something like that was extremely error-prone and generally difficult. That&amp;rsquo;s why &lt;a href="https://pmem.io/blog/2015/06/type-safety-macros-in-libpmemobj/">considerable effort&lt;/a> was put into encapsulating the PMEMoids with type-safe container. The end result can be compared with how &lt;code>shared_ptr&lt;/code> and the like are done in C++11. All posts after this one will solely use the type-safety features.&lt;/p></description></item><item><title>An introduction to pmemobj (part 2) - transactions</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-2-transactions/</link><pubDate>Mon, 15 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-2-transactions/</guid><description>&lt;p>By now you should be fairly familiar with the basics persistent memory programming, but to make sure the application is always in a consistent state you had to rely on your own solutions and tricks - like the length of a buffer in the previous example. Now, we will learn a generic solution provided by pmemobj to this type of problems - transactions. For now we will focus on a single-threaded applications with no locking.&lt;/p></description></item><item><title>An introduction to pmemobj (part 1) - accessing the persistent memory</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-1-accessing-the-persistent-memory/</link><pubDate>Sat, 13 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-1-accessing-the-persistent-memory/</guid><description>&lt;p>In the previous post, you learned a little bit about the general concept of the persistent memory programming model, now it&amp;rsquo;s time to start the coding ;)&lt;/p>
&lt;h3 id="memory-pools">Memory pools&lt;/h3>
&lt;p>If you&amp;rsquo;ve read the &lt;a href="https://pmem.io/blog/2014/09/nvm-library-overview/">overview&lt;/a> you know that persistent memory is exposed by the OS as memory-mapped files, we call them pools.&lt;/p>
&lt;p>The pmemobj library provides an interface to easily manage those pools, so that you don&amp;rsquo;t have to manually create the files or &lt;code>mmap&lt;/code> them. Creating a pool is done using the &lt;code>pmemobj_create&lt;/code> API function, which takes the usual parameters you would expect for a function creating a file plus a &lt;code>layout&lt;/code>, which is a string of your choosing that identifies the pool. It is required that the &lt;code>layout&lt;/code> you pass to &lt;code>pmemobj_open&lt;/code> matches the one the pool was created with. As with any other OS resource, you have to release the pool using &lt;code>pmemobj_close&lt;/code> when the persistent memory pool is no longer needed, usually at the end of the application. To verify the integrity of the pool there&amp;rsquo;s a &lt;code>pmemobj_check&lt;/code> function that verifies if all the required metadata is consistent.&lt;/p></description></item><item><title>An introduction to pmemobj (part 0) - new programming model</title><link>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-0-new-programming-model/</link><pubDate>Fri, 12 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/an-introduction-to-pmemobj-part-0-new-programming-model/</guid><description>&lt;p>The aim of this tutorial series is to introduce you to programming with persistent, byte-addressable memory using the pmemobj library. We will go over all the available features, implement an example application and learn something about the inner workings of libpmemobj. If you haven&amp;rsquo;t read the &lt;a href="https://pmem.io/blog/2014/09/nvm-library-overview/">NVM Library overview&lt;/a> I encourage you to do that now.&lt;/p>
&lt;p>When designing the library API, we&amp;rsquo;ve put a heavy emphasis on ease of use and &amp;ldquo;management explainability&amp;rdquo;, as well as flexibility and performance. Our hope is that the most intuitive solution to a problem is the correct one, but usually there is more than one way of implementing something. In the course of this tutorial I&amp;rsquo;ll make it clear when that&amp;rsquo;s the case and explain what are the pros and cons of the different approaches.&lt;/p></description></item><item><title>Type safety macros in libpmemobj</title><link>https://pmem.io/blog/2015/06/type-safety-macros-in-libpmemobj/</link><pubDate>Thu, 11 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/type-safety-macros-in-libpmemobj/</guid><description>&lt;p>The &lt;em>PMEMoid&lt;/em> plays the role of a persistent pointer in a &lt;em>pmemobj&lt;/em> pool.
It consist of a shortened UUID of the pool which the object comes from and an
offset relative to the beginning of the pool:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">typedef&lt;/span> &lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">pmemoid&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">uint64_t&lt;/span> pool_uuid_lo;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">uint64_t&lt;/span> off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} PMEMoid;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Operating on such &lt;em>persistent pointers&lt;/em> is equivalent to operating on raw
pointers to volatile objects represented by void *. This approach is error
prone and such errors are very hard to find.&lt;/p></description></item><item><title>Implementing (simple) MySQL storage engine with libpmemobj</title><link>https://pmem.io/blog/2015/06/implementing-simple-mysql-storage-engine-with-libpmemobj/</link><pubDate>Tue, 02 Jun 2015 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2015/06/implementing-simple-mysql-storage-engine-with-libpmemobj/</guid><description>&lt;p>The focus of the pmemobj library, like the name suggests, is storing &lt;strong>objects&lt;/strong> on a &lt;strong>persistent&lt;/strong> medium. A different, but very common, approach of doing exactly the same is to use a database with a specialized interface to manipulate the collection of data. MySQL is one such database, it processes SQL queries by calling (usually) multiple methods of the storage engine used for the data tables that query operates on. This tutorial covers basics of the pmemobj library, including non-transactional allocations and very simple transactions.&lt;/p></description></item><item><title>Using the Block Translation Table for sector atomicity</title><link>https://pmem.io/blog/2014/09/using-the-block-translation-table-for-sector-atomicity/</link><pubDate>Tue, 23 Sep 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/09/using-the-block-translation-table-for-sector-atomicity/</guid><description>&lt;p>Persistent memory based storage is able to perform IO at byte (or more
accurately, cache line) granularity. However, we often want to expose such
storage as traditional block devices. The block drivers for persistent memory
will do exactly this. However, they do not provide any atomicity guarantees.
Traditional SSDs typically provide protection against torn sectors in hardware,
using stored energy in capacitors to complete in-flight block writes, or perhaps
in firmware. We don&amp;rsquo;t have this luxury with persistent memory - if a write is in
progress, and we experience a power failure, the block will contain a mix of old
and new data. Applications may not be prepared to handle such a scenario.&lt;/p></description></item><item><title>Git Workflow</title><link>https://pmem.io/blog/2014/09/git-workflow/</link><pubDate>Tue, 09 Sep 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/09/git-workflow/</guid><description>&lt;p>Now that we&amp;rsquo;ve created the &lt;a href="https://github.com/pmem/pmdk">GitHub Repository&lt;/a>
for the PMDK, here&amp;rsquo;s a more detailed description of the git
workflow we&amp;rsquo;ve chosen. The basic idea is:&lt;/p>
&lt;ol>
&lt;li>Current development happens on the &lt;code>master&lt;/code> branch&lt;/li>
&lt;li>Releases are created periodically by &lt;em>tagging&lt;/em>&lt;/li>
&lt;li>After a major release, a &lt;code>stable-1.x&lt;/code> branch is created.
All bug fixes should be committed to the oldest affected branch which is currently
supported. Stable branches will be merged periodically to later branches and master.&lt;/li>
&lt;li>All changes are done using the common GitHub &lt;em>fork and merge&lt;/em> model, where
GitHub users fork the repository, make their changes, and submit
&lt;em>pull requests&lt;/em>.&lt;/li>
&lt;/ol>
&lt;p>Here&amp;rsquo;s a walk-through of the common development workflow, where changes
end up on the &lt;code>master&lt;/code> branch.&lt;/p></description></item><item><title>NVM Library Overview</title><link>https://pmem.io/blog/2014/09/nvm-library-overview/</link><pubDate>Mon, 01 Sep 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/09/nvm-library-overview/</guid><description>&lt;h6 id="edit-on-2017-12-11-in-the-years-since-this-entry-was-written-this-work-has-evolved-into-pmdkpmdk">[Edit on 2017-12-11: In the years since this entry was written, this work has evolved into &lt;a href="https://pmem.io/pmdk/">PMDK&lt;/a>.]&lt;/h6>
&lt;p>Why are we building an NVM Library? Where does it live? How
does it work? This blog entry provides some answers,
which refer to this picture
showing the overall library architecture:&lt;/p>
&lt;p>&lt;img src="https://pmem.io/images/posts/libarch.jpg" alt="Library Architecture">&lt;/p>
&lt;h4 id="why">Why?&lt;/h4>
&lt;p>The operating system exposes persistent memory to applications as
a memory-mapped file, using a &lt;em>persistent memory aware file system&lt;/em>
as shown in the picture. But that&amp;rsquo;s a very &lt;strong>raw&lt;/strong> form of access.
Stopping there would be like telling applications they have all the
dynamic memory they need because the OS provides the
&lt;a href="https://linux.die.net/man/2/sbrk">sbrk(2)&lt;/a> system call. Just as
libc and most other language run-time environments provide memory
management APIs like &lt;a href="https://linux.die.net/man/3/malloc">malloc(3) and free(3)&lt;/a>,
which build on the raw interfaces like sbrk(), we need to do something
similar for persistent memory. Memory-mapping a pmem file gets you
direct access, but then you will want to carve it up into data structures
and update it in a way that remains consistent across system interruptions.&lt;/p></description></item><item><title>Linux Examples</title><link>https://pmem.io/blog/2014/08/linux-examples/</link><pubDate>Fri, 29 Aug 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/08/linux-examples/</guid><description>&lt;h6 id="edit-on-2017-12-11-the-linux-examples-are-outdated-now-look-at-pmdkpmdk-instead">[Edit on 2017-12-11: The Linux examples are outdated now, look at &lt;a href="https://pmem.io/pmdk/">PMDK&lt;/a> instead.]&lt;/h6>
&lt;p>The &lt;a href="https://pmem.io/blog/2014/08/crawl-walk-run.../">basic architecture&lt;/a>.
for exposing persistent memory gives applications a very &lt;strong>raw&lt;/strong>
type of access. Applications can load/store directly to the
persistence, but then what. What are the interesting problems
facing an application developer and what would some solutions
look like?&lt;/p>
&lt;p>To help describe the issues and potential solutions, we&amp;rsquo;ve
published a set of &lt;a href="https://github.com/pmem/linux-examples">Linux examples&lt;/a>
around persistent memory. These examples start with a simple
&amp;ldquo;hello, world!&amp;rdquo; style program for storing a string in persistent
memory, and end with a full binary tree sort example which maintains
a consistent tree data structure even in the face of power failure or
other types of system interruption. The examples include a mini
fault injection framework to illustrate the type of tools that
are necessary for demonstrating programs correctly survive system
interruption.&lt;/p></description></item><item><title>Crawl, Walk, Run...</title><link>https://pmem.io/blog/2014/08/crawl-walk-run.../</link><pubDate>Wed, 27 Aug 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/08/crawl-walk-run.../</guid><description>&lt;blockquote>
&lt;p>&lt;em>If you can&amp;rsquo;t fly then run, if you can&amp;rsquo;t run then walk, if you can&amp;rsquo;t walk then crawl, but whatever you do you have to keep moving forward.&lt;/em>&lt;/p>
&lt;p>Martin Luther King Jr.&lt;/p>
&lt;/blockquote>
&lt;p>This project, as well as the support for persistent memory in
various operating systems, can be thought of as a &lt;em>crawl, walk, run&lt;/em>
approach. As byte-addressable persistence enters the market,
modified system BIOS images and device drivers expose it to
other modules in the kernel. Despite the byte-addressability,
many of the initial usages are based on block storage device
interfaces. But you have to start somewhere, so this is the
&lt;em>crawl&lt;/em> phase. The move beyond that, we need a software
architecture for exposing persistent memory up the stack.&lt;/p></description></item><item><title>References</title><link>https://pmem.io/blog/2014/08/references/</link><pubDate>Tue, 26 Aug 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/08/references/</guid><description>&lt;p>Some very interesting research has been happening in the area of
Persistent Memory and more is emerging. While the examples provided
here are meant as introductory and simple, some publications cover
the topic in much more depth and include complete transaction systems,
compiler/language enhancements, etc. Here are some of the most
important publications in this space (please send links to more and
we&amp;rsquo;ll include them).&lt;/p>
&lt;p>One of the most impressive bodies of work in this area is &lt;strong>Mnemosyne&lt;/strong>.
Read the paper:&lt;/p></description></item><item><title>Creating pmem.io</title><link>https://pmem.io/blog/2014/08/creating-pmem.io/</link><pubDate>Mon, 25 Aug 2014 19:55:17 -0700</pubDate><guid>https://pmem.io/blog/2014/08/creating-pmem.io/</guid><description>&lt;p>The &lt;a href="https://github.com/pmem">pmem&lt;/a> project in GitHub has been
created as an open source project focused on persistent memory programming.
Everything on this web site and the associated GitHub repositories is
open source under the &amp;ldquo;three-clause&amp;rdquo; BSD license.&lt;/p>
&lt;p>Some educational &lt;a href="https://github.com/pmem/linux-examples">Linux examples&lt;/a>
are included, which demonstrate the
&lt;a href="https://snia.org/nvmp">SNIA NVM programming model&lt;/a> and some of the
interesting features and challenges associated with persistent memory.&lt;/p>
&lt;p>The team&amp;rsquo;s initial focus is the Linux &lt;a href="https://pmem.io/nvml/">NVM Library&lt;/a> which
will provide useful APIs for memory allocation, transactions, etc.
built on top of the NVM programming model.&lt;/p></description></item></channel></rss>