Welcome I am Eduardo Berrocal from Intel.
In this video, I present an introduction
to the low level persistent library or LLPL.
An open source Java library being
developed by Intel for persistent memory programming.
LLPL provides Java access to persistent memory
at a memory block level.
Giving developers a foundation for building custom
obstructions or retrofitting existing code.
LLPL compliments persisting collections for Java or PCJ.
Another open source library being
developed by Intel, which emphasizes
persistent collections and provides higher level
functionality such as garbage collection.
LLPL gave us two main obstructions, persistent memory
blocks, and transactions.
Persistent memory blocks are exactly what the names suggest.
That is, a continuous block of memory
carved out of a persistent memory heap.
Under the hood, this persistent heap
is actually a memory mapped file stored on a persistent memory
device.
We can create and open a heap using getHeap.
In LLPL, there are three types of blocks.
Raw, flushable, and transactional.
Objects created and used in these classes
are in reality, reference objects.
They live in volatile memory.
The actual data block resides out
of heap in persistent memory.
And needs to be allocated, as well as destroyed, explicitly.
Persistent data block allocation and destruction is easy.
Thanks to the allocate memory block,
and free memory block methods provided by the heap class
in LLPL.
Similar to PM decay, and to PCJ as well,
we need a common root block to anchor and later find
all the other blocks created inside a persistent heap.
You can think of the root as the entry point.
To set a block as the root, we pass
it's address to the set root method.
To retrieve their root, we call it get root.
Which gives us the address of the block.
The memory block object is recreated by calling the memory
block from address method.
Realize that this method does not
allocate new persistant memory.
It is simply recreating the reference object.
Data access in LLPL is done using a set of accessor method
in the form of getters and setters
for the basic types, byte, short, int, and long.
As well as general memory copy operations.
Getters expect a byte offset relative to the beginning
of the data payload of the block.
And work identically regardless of the block class
used to create the block.
In the case of said method, behavior
depends on the class used to create the block.
For raw blocks, they simply read into the destination.
For flushable blocks, data is written,
and the modified addresses are added to an internal list.
This list is later used in order to know
what addresses should be flushed when
the method flush is called.
Flushing ensures that all pending rights remained
in the CPU caches are safely reading back
to the persistent memory device.
Finally, transactional blocks write the data atomically
using that section.
This atomicity is key when we need to group multiple
operations that need to happen all at the same time,
or not at all.
Transactions are key to ensure that we don't end up
with corrupted data structures when carrying out
sensitive operations to just moving internal pointers.
LLPL is open source and available
in the links provided.
You don't need specialized hardware
to start using and transforming your Java code
for persistent memory today.
If you want to learn more, I urge
you to access the documentation also provided in the links.
Thanks for watching.
Don't forget to like this video and subscribe.