Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer...
Transcript of Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer...
![Page 1: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/1.jpg)
Tomasz Kapela, @tomaszkapela
LinuxCon Europe, Berlin 2016
![Page 2: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/2.jpg)
Hype
![Page 3: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/3.jpg)
3
The NVM programming model
![Page 4: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/4.jpg)
The solution
![Page 5: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/5.jpg)
5
NVMLOpen source set of libraries available at www.github.com/pmem/nvml
Library Description
libpmem The basic library, flush to persistence
libvmem Volatile Memory Allocator
libvmmalloc Transparent use of libvmem
libpmemblk Persistent memory carved into blocks
libpmemlog Log file (append-mostly)
libpmemobj Transactional Object Store
![Page 6: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/6.jpg)
6
libpmemobj
Application
libpmem
Load/Store
memory-mapped pmem
libpmemobj
transactionsatomic
operations
allocatorlists
locks
API API API
![Page 7: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/7.jpg)
Pointers by libpmemobj
![Page 8: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/8.jpg)
8
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 9: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/9.jpg)
9
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 10: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/10.jpg)
10
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 11: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/11.jpg)
11
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 12: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/12.jpg)
12
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
![Page 13: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/13.jpg)
13
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 14: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/14.jpg)
14
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
A lot of macros to make this feasible
![Page 15: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/15.jpg)
15
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 16: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/16.jpg)
16
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
A lot of macros to make this feasible
A lot of macros to handle the TOID
![Page 17: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/17.jpg)
17
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 18: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/18.jpg)
18
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
A lot of macros to make this feasible
A lot of macros to handle the TOID
– Why?
![Page 19: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/19.jpg)
19
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
![Page 20: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/20.jpg)
20
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
A lot of macros to make this feasible
A lot of macros to handle the TOID
– Why?
Is it usable?
![Page 21: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/21.jpg)
21
The fancy typed pointer – TOID
Type safety introduced to a fancy based pointer.
Type declarations necessary
A lot of macros to make this feasible
A lot of macros to handle the TOID
– Why?
Is it usable?
![Page 22: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/22.jpg)
Addressing the pain points
![Page 23: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/23.jpg)
23
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
No explicit type declaration
![Page 24: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/24.jpg)
24
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
No explicit type declaration
– typeid(T).hash_code()
![Page 25: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/25.jpg)
25
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
No explicit type declaration
– typeid(T).hash_code()
No more macros!
![Page 26: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/26.jpg)
26
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
![Page 27: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/27.jpg)
27
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
No explicit type declaration
– typeid(T).hash_code()
No more macros!
Mimics a well known construct
– std::shared_ptr
Now is it usable?
![Page 28: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/28.jpg)
28
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
![Page 29: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/29.jpg)
29
The fancy typed pointer – persistent_ptr
Encapsulate type info into a smart pointer.
![Page 30: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/30.jpg)
30
The fancy typed pointer – persistent_ptr
Known issues
No polymorphic types allowed in persistent memory
– Vtables rebuild issue
typeid(T).hash_code()
– Returns an unspecified value, except that within a single execution of the program, it shall return the same value for any two type_info objects which compare equal.
![Page 31: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/31.jpg)
Transactions by libpmemobj
![Page 32: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/32.jpg)
32
Transactions
Consistency critical roll-back transactions.
ACID like properties
![Page 33: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/33.jpg)
33
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
![Page 34: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/34.jpg)
34
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
![Page 35: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/35.jpg)
35
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
![Page 36: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/36.jpg)
36
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
Macros to make this usable
![Page 37: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/37.jpg)
37
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
Macros to make this usable
![Page 38: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/38.jpg)
38
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
Macros to make this usable
![Page 39: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/39.jpg)
39
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
Macros to make this usable
A bit error prone
– Even with the macros
![Page 40: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/40.jpg)
40
Transactions
Consistency critical roll-back transactions.
![Page 41: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/41.jpg)
41
Transactions
Consistency critical roll-back transactions.
ACID like properties
„C” exceptions
Macros to make this usable
A bit error prone
– Even with the macros
Snapshotting
![Page 42: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/42.jpg)
42
Transactions
Consistency critical roll-back transactions.
![Page 43: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/43.jpg)
Addressing the pain points
![Page 44: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/44.jpg)
44
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
![Page 45: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/45.jpg)
45
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
![Page 46: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/46.jpg)
46
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
![Page 47: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/47.jpg)
47
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– CppCon2015/Declarative Control Flow - Andrei Alexandrescu
![Page 48: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/48.jpg)
48
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– Still can’t throw an exception though
![Page 49: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/49.jpg)
49
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– Still can’t throw an exception though
The lambda version
![Page 50: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/50.jpg)
50
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– Still can’t throw an exception though
The lambda version
![Page 51: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/51.jpg)
51
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– Still can’t throw an exception though
The lambda version
![Page 52: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/52.jpg)
52
Transactions
Making life easier with RAII and lambdas.
Manual and automatic transaction
– The problem with std::uncaught_exception
– Still can’t throw an exception though
The lambda version
– Self contained
– Somewhat ugly looking
![Page 53: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/53.jpg)
Using the containers
![Page 54: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/54.jpg)
54
Persistent memory containers
A proof of concept under way.
Targeting libc++ and libstdc++
![Page 55: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/55.jpg)
55
Persistent memory containers
A proof of concept under way.
Targeting libc++ and libstdc++
![Page 56: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/56.jpg)
56
Persistent memory containers
A proof of concept under way.
Targeting libc++ and libstdc++
– Libc++ is mostly working
– Libstdc++ needs a bit more work
![Page 57: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/57.jpg)
57
Persistent memory containers
A proof of concept under way.
Targeting libc++ and libstdc++
– Libc++ is mostly working
– Libstdc++ needs a bit more work
![Page 58: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/58.jpg)
58
Persistent memory containers
A proof of concept under way.
Targeting libc++ and libstdc++
– Libc++ is mostly working
– Libstdc++ needs a bit more work
Main pros
– It’s for free! (well, almost)
– Familiar interface
– Well tested implementation of containers
![Page 59: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/59.jpg)
59
Persistent memory containers
What are the known issues
Internally held data is not „aware” of persistence
T* used instead of allocator_traits::pointer
Layout versioning
Current implementation works only on x86_64
![Page 60: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/60.jpg)
![Page 61: Tomasz Kapela, @tomaszkapela LinuxCon Europe, Berlin 2016...The fancy typed pointer –persistent_ptr Known issues No polymorphic types allowed in persistent memory –Vtables rebuild](https://reader035.fdocuments.us/reader035/viewer/2022071506/61268a2b8e799a7fec4fcbab/html5/thumbnails/61.jpg)
61
Handy links
The allocator branch:
https://github.com/tomaszkapela/nvml/tree/cpp-allocator
Libpmemobj++ documentation:
http://pmem.io/nvml/cpp_obj/
Pmem Google Groups page:
https://groups.google.com/forum/#!forum/pmem