Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit e93d206

Browse files
Pawel Karczewskilukaszstolarczuk
authored andcommitted
[doc] Add synchronization primitives description
1 parent d942b3f commit e93d206

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

doc/groups_definitions.dox

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@
106106
* All operations between creating and destroying the transaction
107107
* object are treated as performed in a transaction block and
108108
* can be rolled back.
109-
* The locks are held for the entire duration of the transaction. They
110-
* are released at the end of the scope, so within the `catch` block,
111-
* they are already unlocked.
112109
* The best way to use manual transactions is by
113110
* @ref pmem::obj::transaction::run, which is used in example above.
114111
*
@@ -117,8 +114,9 @@
117114
* performed in a transaction block and can be rolled back.
118115
* If you have a C++17 compliant compiler, the automatic transaction will
119116
* commit and abort automatically depending on the context of object's destruction.
120-
* The locks are held for the entire duration of the transaction. They
121-
* are released at the end of the scope, so within the `catch` block,
117+
*
118+
* In both approaches one of the parameters is the `locks`. They are held for the entire duration
119+
* of the transaction and they are released at the end of the scope - so within the `catch` block,
122120
* they are already unlocked.
123121
*
124122
* If you want to read more and see example usages of both, you have to see
@@ -191,7 +189,24 @@
191189
* take a look at description of each class to get the details of their behavior.
192190
*/
193191

194-
/** @defgroup synchronization Synchronization Primitives*/
192+
/** @defgroup synchronization Synchronization Primitives
193+
* Persistent memory resident implementation of synchronization primitives.
194+
*
195+
* In concurrent programming, we often require mechanisms for synchronizing access to shared resources.
196+
* Typically to solve such issues we use synchronization primitives like mutexes and condition variables.
197+
* As persistent memory offers bigger capacity than DRAM it may be useful to store synchronization primitives
198+
* on it. Unfortunately such approach may cause performance degradation due to frequent writes to a memory
199+
* with relatively higher latency (it's because taking a lock or signaling a conditional variable often
200+
* requires additional writes). Few extra words how locks can be used in libpmemobj-cpp can be found in
201+
* @ref transactions.
202+
*
203+
* It's worth noticing that pmem locks are automatically released on recovery or when crash happened.
204+
*
205+
* # Additional resources
206+
* - [Libpmemobj-cpp - lessons learned](https://pmem.io/blog/2021/09/libpmemobj-cpp-lessons-learned)
207+
* In this blog post we explain, i.a., why keeping locks on pmem is not a good idea.
208+
*/
209+
195210
/** @defgroup primitives Primitives
196211
* Basic classes that provides PMEM-aware pointers and pool handlers.
197212
*
@@ -256,4 +271,4 @@
256271
*
257272
* You should check every function you will use in context of possible
258273
* exceptions and then handle them to avoid crash.
259-
**/
274+
*/

0 commit comments

Comments
 (0)