Persistent Memory Programming Part 4: Thinking Transactionally

Andy Rudoff is a Non-volatile Memory Software Architect at Intel Corporation and a member of the SNIA (Storage Networking Industry Association) Non-volatile Memory Programming Technical Work Group. In this video, Andy describes a persistent memory-resident queue example, and describes the need for transactional updates to those data structures.

 

Hi, I'm Andy Rudolph from Intel. This video will walk through the data structure designed for our persistent memory programming queue example. Don't forget to watch the rest of this playlist on persistent memory programming to learn more. The first step is to define the data structures we need. My example will be a simple queue managed by head and tail pointers. When the head and tail are null pointers, the queue is empty, as I'm showing here. As entries are added to the queue, the head pointer points to the first entry in the queue and the tail pointer to the last entry. As I show here, a new struct pmem_entry is allocated each time an entry is added to the queue. 

Now, consider storing this data structure in persistent memory. The class pmem_queue, where the head and tail pointers are kept, is the first data structure our program will access to get to the queue. All the entries in the queue are linked off this primary data structure. In persistent memory, we refer to this as the root object. You can see how an application storing a queue in persistent memory must begin by finding the root object in the pmem pool, as I've shown here. The lib pemem obj library provides an interface to access the root object, as you'll see in the other videos in this playlist when we look at the application code. 

Once the application has the root object, we can add and remove entries from the queue. Since this is persistent memory, the data structures are updated in place and pointers are used to get between the allocations, just like any other memory resident data structures, but since this memory has persistent, changes must be made transactional so that adding a new entry cannot be left partially complete if the program or machine crashes. The allocation of entries and the ability to add them and delete them transactionally is some pretty tricky programming. This tricky programming is exactly why we invented lib pmem obj. The library provides general purpose transactions and persistent memory allocation. 

In other videos in this playlist, I'll convert these ideas into c++ code to provide a concrete example using the lib pmem obj library. Thanks for watching. To learn more, check out the persistent memory programming playlist and visit the links in the description below. Don't forget to like this video and subscribe to the Intel software YouTube channel.