How is thread-safety guaranteed for pmemobj_alloc?

37 views
Skip to first unread message

pmem

unread,
Sep 19, 2023, 10:00:50 AM9/19/23
to pmem
The documentation for libpmemobj, states that "Functions described in this document provide the mechanism to allocate, resize and free objects from the persistent memory pool in a thread-safe and fail-safe manner".

I'm trying to understand exactly thread-safety is achieved in the code, specially for pmemobj_alloc and pmemobj_free, but sadly to no avail.

Can anyone provide me with some pointers torwards the source where TS is guaranteed?

Thank you

Jan K

unread,
Sep 22, 2023, 4:57:17 AM9/22/23
to pmem, pmem
> Can anyone provide me with some pointers torwards the source where TS is guaranteed?
Did you look at this:
https://github.com/pmem/pmdk/blob/master/src/libpmemobj/palloc.c ?
There's a rough description in the comments there, once you go through
it, have a look at palloc_exec_actions.
I warn you that the allocator in PMDK is unbearably slow, so if you
can avoid extra allocs/frees, then better do avoid it.

(And the transacion logs get thread-safety somewhere here:
https://github.com/pmem/pmdk/blob/master/src/libpmemobj/lane.c .)

Regards,
Jan


2023-09-19 16:00 GMT+02:00, 'pmem' via pmem <pm...@googlegroups.com>:
> The documentation for libpmemobj, states that "Functions described in this
> document provide the mechanism to allocate, resize and free objects from
> the persistent memory pool in a *thread-safe *and fail-safe manner".
>
> I'm trying to understand exactly thread-safety is achieved in the code,
> specially for pmemobj_alloc and pmemobj_free, but sadly to no avail.
>
> Can anyone provide me with some pointers torwards the source where TS is
> guaranteed?
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "pmem" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pmem+uns...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pmem/511bc8f2-1c27-4bc3-9b18-f077617ad72fn%40googlegroups.com.
>
Reply all
Reply to author
Forward
0 new messages