[Python-ideas] Application awareness of memory storage classes

Piotr Balcer ppbbalcer at gmail.com
Thu May 19 10:42:56 EDT 2016


To build on what David has said about the C++ - this in fact exactly what
we've done for our language support :)

Long story short, for C++ we introduce two new base types: a persistent
smart pointer and a persistent memory resident variable. To complement that
there's a support for transactions implemented in two ways: by providing
a function to execute as transaction or by using RAII.

Here's a very simple queue implemented using those features:
https://github.com/pmem/nvml/tree/master/src/examples/libpmemobj/cpp

But back on topic of custom allocators: we've prototyped a STL compatible
allocator that allowed us to use the std::vector, std::list and other
STL containers without any modifications by simply providing the allocator
template argument. This was possible because the allocator provides the
facility to provide a pointer type argument which is persistent_ptr<T> in
our case.

Were the CPython implemented in C++ it would probably be possible to
implement the collections in a way that creating a specialized ones would
be very easy:
class PersistentDictionary<T> : Dictionary<T, persistent_alloc>
But I guess that's out of the question ;)

I'm afraid I won't be much of a help for the python specific stuff but I'm
happy to answer any questions about persistent memory programming in
general.

Piotr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160519/16668bb2/attachment.html>


More information about the Python-ideas mailing list